diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-03 12:11:12 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-03 12:11:12 +0000 |
commit | 53eca3abc8c4f0627ee1bb7ff61caa32392d6384 (patch) | |
tree | b4630d877d6f69b439a38e5a4bc6a2a8d826feee | |
parent | 780151c01e7e2d953f2701c2b931a1b33e4b88ca (diff) | |
download | rails-53eca3abc8c4f0627ee1bb7ff61caa32392d6384.tar.gz rails-53eca3abc8c4f0627ee1bb7ff61caa32392d6384.tar.bz2 rails-53eca3abc8c4f0627ee1bb7ff61caa32392d6384.zip |
Add --measure option to script/performance/request to set ruby-prof measure mode: process_time, wall_time, cpu_time, allocations, memory.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8792 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-x | actionpack/lib/action_controller/request_profiler.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/request_profiler.rb b/actionpack/lib/action_controller/request_profiler.rb index 6a023b652e..8a18d194bd 100755 --- a/actionpack/lib/action_controller/request_profiler.rb +++ b/actionpack/lib/action_controller/request_profiler.rb @@ -119,6 +119,7 @@ module ActionController opt.on('-n', '--times [100]', 'How many requests to process. Defaults to 100.') { |v| options[:n] = v.to_i if v } opt.on('-b', '--benchmark', 'Benchmark instead of profiling') { |v| options[:benchmark] = v } + opt.on('-m', '--measure [mode]', 'Which ruby-prof measure mode to use: process_time, wall_time, cpu_time, allocations, or memory. Defaults to process_time.') { |v| options[:measure] = v } opt.on('--open [CMD]', 'Command to open profile results. Defaults to "open %s &"') { |v| options[:open] = v } opt.on('-h', '--help', 'Show this help') { puts opt; exit } @@ -136,7 +137,9 @@ module ActionController def load_ruby_prof begin require 'ruby-prof' - #RubyProf.measure_mode = RubyProf::ALLOCATED_OBJECTS + if mode = options[:measure] + RubyProf.measure_mode = RubyProf.const_get(mode.upcase) + end rescue LoadError abort '`gem install ruby-prof` to use the profiler' end |