Created
October 14, 2010 02:31
-
-
Save tommeier/625437 to your computer and use it in GitHub Desktop.
How to use Ruby Prof to analyse method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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