aboutsummaryrefslogblamecommitdiffstats
path: root/railties/bin/profiler
blob: f0f14a2b998f9f193b4ef7e238b3982b1259a351 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                              


                                          



                                              
#!/usr/local/bin/ruby

if ARGV.empty?
  puts "Usage: profiler 'Person.expensive_method(10)' [times]"
  exit
end

require File.dirname(__FILE__) + '/../config/environment'
require "profiler"

# Don't include compilation in the profile
eval(ARGV.first)

Profiler__::start_profile
(ARGV[1] || 1).to_i.times { eval(ARGV.first) }
Profiler__::stop_profile
Profiler__::print_profile($stdout)