Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created September 7, 2012 03:55
Show Gist options
  • Save jugyo/3662942 to your computer and use it in GitHub Desktop.
Save jugyo/3662942 to your computer and use it in GitHub Desktop.
getting profile for rails
def prof(&block)
result = RubyProf.profile(&block)
filename = "result-#{Time.now.to_i}.html"
File.open(filename, 'w') do |file|
RubyProf::FlatPrinter.new(result).print(file, :min_percent => 1)
end
puts "=> #{filename}"
end
# Load the rails application
require File.expand_path('../application', __FILE__)
prof do
# Initialize the rails application
Rails3Profile::Application.initialize!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment