Sha256: bf36d0a46a82a47e0f4f7b30817cc3238a876039d10cdb743ed1329ba8b54868

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

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

require 'benchkit'
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: #{Benchkit::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: #{Benchkit::DEFAULT_LOOP_COUNT})") do |l|
    options[:measure_type] = 'loop_count'
    options[:measure_num]  = 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 = Benchkit.new(options)
args.each do |yaml|
  default = { name: File.basename(yaml, '.*') }
  driver.run(default.merge(YAML.load(File.read(yaml))))
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
benchkit-0.2.1 exe/benchkit
benchkit-0.2.0 exe/benchkit