lib/benchmark_driver/runner/ips.rb in benchmark_driver-0.11.0 vs lib/benchmark_driver/runner/ips.rb in benchmark_driver-0.11.1
- old
+ new
@@ -49,11 +49,12 @@
@output.with_benchmark do
jobs.each do |job|
@output.with_job(name: job.name) do
job.runnable_execs(@config.executables).each do |exec|
- value, duration = with_repeat(@config.repeat_count) do
+ repeat_params = { config: @config, larger_better: true, rest_on_average: :average }
+ value, duration = BenchmarkDriver::Repeater.with_repeat(repeat_params) do
run_benchmark(job, exec: exec)
end
@output.with_context(name: exec.name, executable: exec, duration: duration) do
@output.report(value: value, metric: metric)
end
@@ -83,19 +84,9 @@
end
eval(f.read)
end
[duration, loop_count]
- end
-
- # Return multiple times and return the best metrics
- def with_repeat(repeat_times, &block)
- value_durations = repeat_times.times.map do
- block.call
- end
- value_durations.sort_by do |value, _|
- metric.larger_better ? value : -value
- end.last
end
# @param [BenchmarkDriver::Runner::Ips::Job] job - loop_count is not nil
# @param [BenchmarkDriver::Config::Executable] exec
# @return [BenchmarkDriver::Metrics]