class Bench::Config

Attributes

benchmark_groups[R]
benchmarks[R]
commands[R]
fail_hard_exclusions[R]
implementation_groups[R]
implementations[R]

Public Class Methods

new() click to toggle source
# File lib/bench9000/config.rb, line 20
def initialize
  @implementations = {}
  @implementation_groups = {}
  @benchmarks = {}
  @benchmark_groups = {}
  @fail_hard_exclusions = []
  @commands = {}
end

Public Instance Methods

benchmark(name, file, flags="") click to toggle source
# File lib/bench9000/config.rb, line 59
def benchmark(name, file, flags="")
  @benchmarks[name] = Benchmark.new(name, file, flags)
end
benchmark_group(name, *benchmarks) click to toggle source
# File lib/bench9000/config.rb, line 63
def benchmark_group(name, *benchmarks)
  @benchmark_groups[name] = Group.new(name, benchmarks.map { |b|
    benchmark = @benchmarks[b]

    if benchmark.nil?
      puts "unknown benchmark #{b} in group"
      exit
    end

    benchmark
  })
end
binary(name, binary, flags="") click to toggle source
# File lib/bench9000/config.rb, line 38
def binary(name, binary, flags="")
  @implementations[name] = BinaryImplementation.new(name, binary, flags)
end
command(name, &body) click to toggle source
# File lib/bench9000/config.rb, line 80
def command(name, &body)
  command_class = Class.new(Commands::Command)
  command_class.class_eval(&body)
  @commands[name] = command_class
end
default_benchmarks_dir() click to toggle source
# File lib/bench9000/config.rb, line 55
def default_benchmarks_dir
  File.expand_path(File.dirname(@configuration_file_path))
end
fails_hard(implementation, benchmark) click to toggle source
# File lib/bench9000/config.rb, line 76
def fails_hard(implementation, benchmark)
  @fail_hard_exclusions.push([implementation, benchmark])
end
implementation_group(name, *implementations) click to toggle source
# File lib/bench9000/config.rb, line 42
def implementation_group(name, *implementations)
  @implementation_groups[name] = Group.new(name, implementations.map { |i|
    implementation = @implementations[i]

    if implementation.nil?
      puts "unknown implementation #{i} in group"
      exit
    end

    implementation
  })
end
load(file) click to toggle source
# File lib/bench9000/config.rb, line 29
def load(file)
  @configuration_file_path = file
  eval File.read(file), binding, file, 1
end
rbenv(name, version=name, flags="") click to toggle source
# File lib/bench9000/config.rb, line 34
def rbenv(name, version=name, flags="")
  @implementations[name] = RbenvImplementation.new(name, version, flags)
end