Skip to content

Instantly share code, notes, and snippets.

@jeremy
Created February 23, 2009 21:34
Show Gist options
  • Save jeremy/69190 to your computer and use it in GitHub Desktop.
Save jeremy/69190 to your computer and use it in GitHub Desktop.
# ruby-1.8.6-ree profile_startup.rb process_time|allocations|memory
# kcachegrind profile_startup.memory.tree
require 'rubygems'
require 'ruby-prof'
ENV['RAILS_ENV'] = 'development'
mode = ARGV.shift || 'process_time'
RubyProf.measure_mode = RubyProf.const_get(mode.upcase)
RubyProf.start
require "#{File.dirname(__FILE__)}/config/environment"
results = RubyProf.stop
File.open("profile_startup.#{mode}.tree", 'w') do |out|
RubyProf::CallTreePrinter.new(results).print(out)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment