public Method

RequestProfiler.parse_options(args)

Parse command-line options

Source Code

# File action_controller/request_profiler.rb, line 117
def parse_options(args)
  OptionParser.new do |opt|
    opt.banner = "USAGE: #{$0} [options] [session script path]"

    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 }

    opt.parse args

    if args.empty?
      puts opt
      exit
    end
    options[:script] = args.pop
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.