Sha256: ddeee52e7c86adc3b876c924b90e1071aa49c3f17aa08e735019256c93dc3374

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

#!/usr/bin/env ruby
$:.unshift File.expand_path('../lib', __dir__)

require 'benchmark_driver'
require 'optparse'
require 'yaml'

options = {}
args = OptionParser.new do |o|
  o.banner = "Usage: #{File.basename($0, '.*')} [options] [YAML]"
  o.on('-e', '--executables [EXECS]', 'Ruby executables (e1::path1; e2::path2; e3::path3;...)') do |e|
    options[:execs] ||= []
    e.split(/;/).each do |path|
      options[:execs] << path
    end
  end
  o.on('-i [DURATION]', '--ips [SECONDS]', "Measure IPS in duration seconds (default: #{BenchmarkDriver::DEFAULT_IPS_DURATION})") do |i|
    options[:measure_type] = 'ips'
    options[:measure_num]  = Integer(i) if i
  end
  o.on('-l [COUNT]', '--loop-count [COUNT]', "Measure execution time with loop count (default: #{BenchmarkDriver::DEFAULT_LOOP_COUNT})") do |l|
    options[:measure_type] = 'loop_count'
    options[:measure_num]  = Integer(l) if l
  end
  o.on('-v', '--verbose') do |v|
    options[:verbose] = v
  end
end.parse!(ARGV)
abort "No YAML file is specified" if args.empty?

driver = BenchmarkDriver.new(options)
args.each do |yaml|
  default = { name: File.basename(yaml, '.*') }
  driver.run(default.merge(YAML.load(File.read(yaml))))
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchmark_driver-0.2.2 exe/benchmark_driver