Skip to content

Instantly share code, notes, and snippets.

@tommeier
Created October 14, 2010 02:31
Show Gist options
  • Save tommeier/625437 to your computer and use it in GitHub Desktop.
Save tommeier/625437 to your computer and use it in GitHub Desktop.
How to use Ruby Prof to analyse method
#Use ruby prof to analyse
require 'ruby-prof'
result = RubyProf.profile do
#Code to analyse in a method
end
# Print a graph profile to text
printer = RubyProf::GraphHtmlPrinter.new(result)
File.open(File.join(RAILS_ROOT, 'profile_output.html'), 'w') do |file|
printer.print(file, {:min_percent => 10, :print_file => true})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment