lib/benchmark_driver/runner/ips.rb in benchmark_driver-0.9.2 vs lib/benchmark_driver/runner/ips.rb in benchmark_driver-0.10.0
- old
+ new
@@ -9,23 +9,25 @@
class BenchmarkDriver::Runner::Ips
# JobParser returns this, `BenchmarkDriver::Runner.runner_for` searches "*::Job"
Job = Class.new(BenchmarkDriver::DefaultJob)
# Dynamically fetched and used by `BenchmarkDriver::JobParser.parse`
JobParser = BenchmarkDriver::DefaultJobParser.for(Job)
- # Passed to `output` by `BenchmarkDriver::Runner.run`
- MetricsType = BenchmarkDriver::Metrics::Type.new(unit: 'i/s')
+ METRICS_TYPE = BenchmarkDriver::Metrics::Type.new(unit: 'i/s')
+
# @param [BenchmarkDriver::Config::RunnerConfig] config
# @param [BenchmarkDriver::Output::*] output
def initialize(config:, output:)
@config = config
@output = output
end
# This method is dynamically called by `BenchmarkDriver::JobRunner.run`
# @param [Array<BenchmarkDriver::Default::Job>] jobs
def run(jobs)
+ set_metrics_type
+
if jobs.any? { |job| job.loop_count.nil? }
@output.with_warmup do
jobs = jobs.map do |job|
next job if job.loop_count # skip warmup if loop_count is set
@@ -119,9 +121,14 @@
BenchmarkDriver::Metrics.new(
value: loop_count.to_f / duration,
duration: duration,
executable: executable,
)
+ end
+
+ # This method is overridden by BenchmarkDriver::Runner::Time
+ def set_metrics_type
+ @output.metrics_type = METRICS_TYPE
end
def with_script(script)
if @config.verbose >= 2
sep = '-' * 30