Class: BenchmarkDriver::Runner::Once
- Inherits:
-
Object
- Object
- BenchmarkDriver::Runner::Once
- Defined in:
- lib/benchmark_driver/runner/once.rb
Overview
Run only once, for testing
Constant Summary collapse
- Job =
JobParser returns this,
BenchmarkDriver::Runner.runner_forsearches “*::Job” Class.new(BenchmarkDriver::DefaultJob)
- JobParser =
Dynamically fetched and used by
BenchmarkDriver::JobParser.parse BenchmarkDriver::DefaultJobParser.for(Job)
- METRICS_TYPE =
BenchmarkDriver::Metrics::Type.new(unit: 'i/s')
Instance Method Summary collapse
-
#initialize(config:, output:) ⇒ Once
constructor
A new instance of Once.
-
#run(jobs) ⇒ Object
This method is dynamically called by
BenchmarkDriver::JobRunner.run.
Constructor Details
#initialize(config:, output:) ⇒ Once
Returns a new instance of Once.
19 20 21 22 |
# File 'lib/benchmark_driver/runner/once.rb', line 19 def initialize(config:, output:) @config = config @output = output end |
Instance Method Details
#run(jobs) ⇒ Object
This method is dynamically called by BenchmarkDriver::JobRunner.run
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/benchmark_driver/runner/once.rb', line 26 def run(jobs) @output.metrics_type = METRICS_TYPE jobs = jobs.map do |job| Job.new(job.to_h.merge(loop_count: 1)) # to show this on output end @output.with_benchmark do jobs.each do |job| @output.with_job(job) do @config.executables.each do |exec| metrics = run_benchmark(job, exec: exec) # no repeat support @output.report(metrics) end end end end end |