Module: Benchmark::Driver
- Defined in:
- lib/benchmark/driver.rb,
lib/benchmark/driver/error.rb,
lib/benchmark/driver/version.rb
Defined Under Namespace
Modules: Time, YamlParser Classes: BenchmarkResult, Configuration, DurationRunner, Error, ExecutionTimeTooShort, RepeatableRunner, RubyDslParser
Constant Summary collapse
- VERSION =
'0.4.2'
Class Method Summary collapse
-
.run(config) ⇒ Object
Main function which is used by both RubyDriver and YamlDriver.
Class Method Details
.run(config) ⇒ Object
Main function which is used by both RubyDriver and YamlDriver.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/benchmark/driver.rb', line 6 def run(config) validate_config(config) runner_class = Runner.find(config..type) output_class = Output.find(config..type) missing_fields = output_class::REQUIRED_FIELDS - runner_class::SUPPORTED_FIELDS unless missing_fields.empty? raise ArgumentError.new( "#{output_class.name} requires #{missing_fields.inspect} fields "\ "which are not supported by #{runner_class.name}. Try using another runner." ) end without_stdout_buffering do runner = runner_class.new( config., output: output_class.new( jobs: config.jobs, executables: config..executables, options: config., ), ) runner.run(config) end rescue Benchmark::Driver::Error => e $stderr.puts "\n\nFailed to execute benchmark!\n\n#{e.class.name}:\n #{e.}" exit 1 end |