module BigBench::Configuration

The configuration is configured in the test reciepts and looks like this:

BigBench.configure = {
  :duration => 10.seconds,
  :output   => "test.ljson",
  :threads  => 20
}

Single values can be set and retrieved like this:

BigBench.config.duration = 20.minutes
BigBench.config.duration # => 1200 (seconds)

The following configuration values are possible - stared configurations need to be present:

duration*

How long will the benchmark take by default. This value can be overridden by every benchmark.

output*

The file where the results should be written to. Usually one takes the *.ljson format which is simply a file that contains a fully valid JSON object on every line. This makes it easy to process the results later on, because there’s no need to parse the whole results JSON, which can get huge, at once.

threads

How many threads execute the benchmarks. This can be overridden by every benchmark and defaults to 1.

Public Class Methods

config() click to toggle source

Returns the current config object

# File lib/bigbench/configuration.rb, line 70
def self.config
  @config
end
configure=(config) click to toggle source

Configures the benchmarks with a hash. If the config methods are not present yet, they are added to the config object

# File lib/bigbench/configuration.rb, line 61
def self.configure=(config)
  raise "Config must be a Hash" unless config.is_a?(Hash)
  config.each { |option, value|
    @config.class.add_option(option)
    @config.send "#{option}=", value
  }
end
reset!() click to toggle source

Resets the config object

# File lib/bigbench/configuration.rb, line 75
def self.reset!
  @config = Config.new
end