Skip to content

Instantly share code, notes, and snippets.

@anildigital
Created October 16, 2008 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anildigital/17108 to your computer and use it in GitHub Desktop.
Save anildigital/17108 to your computer and use it in GitHub Desktop.
# Profiler starts
require 'ruby-prof'
RubyProf.start
@return_data = your_method(@your_data)
result = RubyProf.stop
printer = RubyProf::GraphHtmlPrinter.new(result)
path = File.join(RAILS_ROOT, 'public', 'profiling_output.html')
File.open(path, 'w') do |file|
printer.print(file, {:min_percent => 1,
:print_file => true})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment