Created
June 14, 2011 18:08
-
-
Save bmarini/1025483 to your computer and use it in GitHub Desktop.
ruby-prof scaffold code
This file contains 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
require 'ruby-prof' | |
# RubyProf.measure_mode = RubyProf::PROCESS_TIME | |
# RubyProf.measure_mode = RubyProf::WALL_TIME | |
# RubyProf.measure_mode = RubyProf::CPU_TIME | |
# RubyProf.measure_mode = RubyProf::ALLOCATIONS | |
# RubyProf.measure_mode = RubyProf::MEMORY | |
# RubyProf.measure_mode = RubyProf::GC_RUNS | |
# RubyProf.measure_mode = RubyProf::GC_TIME | |
result = RubyProf.profile do | |
# Do stuff in here | |
end | |
# Print a graph profile to text | |
printer = RubyProf::GraphHtmlPrinter.new(result) | |
File.open(Rails.root.join("tmp/performance/profile_blah.html"), "w") do |file| | |
printer.print(file, {:min_percent => 10}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment