Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8792

Show
Ignore:
Timestamp:
02/03/08 12:11:12 (10 months ago)
Author:
bitsweat
Message:

Add --measure option to script/performance/request to set ruby-prof measure mode: process_time, wall_time, cpu_time, allocations, memory.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/request_profiler.rb

    r8701 r8792  
    120120        opt.on('-n', '--times [100]', 'How many requests to process. Defaults to 100.') { |v| options[:n] = v.to_i if v } 
    121121        opt.on('-b', '--benchmark', 'Benchmark instead of profiling') { |v| options[:benchmark] = v } 
     122        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 } 
    122123        opt.on('--open [CMD]', 'Command to open profile results. Defaults to "open %s &"') { |v| options[:open] = v } 
    123124        opt.on('-h', '--help', 'Show this help') { puts opt; exit } 
     
    137138        begin 
    138139          require 'ruby-prof' 
    139           #RubyProf.measure_mode = RubyProf::ALLOCATED_OBJECTS 
     140          if mode = options[:measure] 
     141            RubyProf.measure_mode = RubyProf.const_get(mode.upcase) 
     142          end 
    140143        rescue LoadError 
    141144          abort '`gem install ruby-prof` to use the profiler'