Sha256: a15be9d61b4652cead45476be6abd4e753f0568d3379d8c1ea2cdec0afddf741

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'mach5-tools'
require 'thor'

class App < Thor
  desc "benchmark", "Run benchmarks"
  method_option :all, :type => :boolean, :aliases => "-a", :desc => "Run all benchmarks even if there is already a result"
  method_option :list, :type => :boolean, :aliases => "-l", :desc => "List all available benchmarks"
  method_option :only, :type => :array, :aliases => "-o", :desc => "Run only the specified benchmarks"
  def benchmark
    runner = Mach5::Runner.new(eval(File.open("Mach5file").readlines.join))
    if options.list
      runner.list_benchmarks.each do |benchmark|
        puts benchmark
      end
    elsif options.only
      runner.benchmark(only: options.only)
    else
      runner.benchmark(all: options.all)
    end
  end

  desc "chart", "Generate charts"
  method_option :all, :type => :boolean, :aliases => "-a", :desc => "Generates all benchmarks even if it was already generated"
  method_option :list, :type => :boolean, :aliases => "-l", :desc => "List all available charts"
  method_option :only, :type => :array, :aliases => "-o", :desc => "Generates only the specified charts"
  def chart
    runner = Mach5::Runner.new(eval(File.open("Mach5file").readlines.join))
    if options.list
      runner.list_charts.each do |chart|
        puts chart
      end
    elsif options.only
      runner.chart(only: options.only)
    else
      runner.chart(all: options.all)
    end
  end

  default_task :benchmark
end

App.start

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mach5-tools-0.2.2 bin/mach5
mach5-tools-0.2.1 bin/mach5
mach5-tools-0.2.0 bin/mach5