Sha256: d42614f84f3b145f63f79c56749e14e840060db7bd3bffc744b60982cc8dfbff

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 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('-d', '--duration [SECONDS]', 'Duration seconds to run each benchmark (default: 1)') do |n|
    options[:duration] = n.to_i
  end
  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('-r', "--result-format=FORMAT", "Result output format [time|ips] (default: time)", %w[time ips]) do |r|
    options[:result_format] = r
  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|
  benchmarks = YAML.load(File.read(yaml))
  if benchmarks.is_a?(Hash)
    benchmarks[:name] = File.basename(yaml, '.*')
  end
  driver.run(benchmarks)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchmark_driver-0.1.0 exe/benchmark_driver