class BenchmarkDriver::Runner::Ips

def run_benchmark(job, context:)

Returns:
  • (BenchmarkDriver::Metrics) -

Parameters:
  • context (BenchmarkDriver::Context) --
  • job (BenchmarkDriver::Runner::Ips::Job) -- - loop_count is not nil
def run_benchmark(job, context:)
  benchmark = BenchmarkScript.new(
    preludes:   [context.prelude, job.prelude],
    script:     job.script,
    teardown:   job.teardown,
    loop_count: job.loop_count,
  )
  duration = Tempfile.open(['benchmark_driver-', '.rb']) do |f|
    with_script(benchmark.render(result: f.path)) do |path|
      success = execute(*context.executable.command, path, exception: false)
      if success && ((value = Float(f.read)) > 0)
        value
      else
        BenchmarkDriver::Result::ERROR
      end
    end
  end
  value_duration(
    loop_count: job.loop_count,
    duration: duration,
  )
end