lib/benchmark_driver/runner/memory.rb in benchmark_driver-0.9.2 vs lib/benchmark_driver/runner/memory.rb in benchmark_driver-0.10.0

- old
+ new

@@ -9,13 +9,13 @@ class BenchmarkDriver::Runner::Memory # 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: 'bytes', larger_better: false, worse_word: 'larger') + METRICS_TYPE = BenchmarkDriver::Metrics::Type.new(unit: 'bytes', larger_better: false, worse_word: 'larger') + # @param [BenchmarkDriver::Config::RunnerConfig] config # @param [BenchmarkDriver::Output::*] output def initialize(config:, output:) @config = config @output = output @@ -26,9 +26,11 @@ def run(jobs) # Currently Linux's time(1) support only... if Etc.uname.fetch(:sysname) != 'Linux' raise "memory output is not supported for '#{Etc.uname[:sysname]}' for now" end + + @output.metrics_type = METRICS_TYPE if jobs.any? { |job| job.loop_count.nil? } jobs = jobs.map do |job| job.loop_count ? job : Job.new(job.to_h.merge(loop_count: 1)) end