Skip to content

Instantly share code, notes, and snippets.

@kbaum
Created December 5, 2011 21:52
Show Gist options
  • Save kbaum/1435547 to your computer and use it in GitHub Desktop.
Save kbaum/1435547 to your computer and use it in GitHub Desktop.
if ENV['RUBY_PROF'].present?
require 'ruby-prof'
RubyProf.start
at_exit do
results = RubyProf.stop
File.open "#{Rails.root}/tmp/profile-graph.html", 'w' do |file|
RubyProf::GraphHtmlPrinter.new(results).print(file)
end
File.open "#{Rails.root}/tmp/profile-flat.txt", 'w' do |file|
RubyProf::FlatPrinter.new(results).print(file)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment