class BenchmarkDriver::Runner::Ips

def run(jobs)

Parameters:
  • jobs (Array) --
def run(jobs)
  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
        @output.with_job(name: job.name) do
          context = job.runnable_contexts(@contexts).first
          duration, loop_count = run_warmup(job, context: context)
          value, duration = value_duration(duration: duration, loop_count: loop_count)
          @output.with_context(name: context.name, executable: context.executable, gems: context.gems, prelude: context.prelude) do
            @output.report(values: { metric => value }, duration: duration, loop_count: loop_count)
          end
          job.loop_count = (loop_count.to_f * @config.run_duration / duration).floor
          job
        end
      end
    end
  end
  @output.with_benchmark do
    jobs.each do |job|
      @output.with_job(name: job.name) do
        job.runnable_contexts(@contexts).each do |context|
          repeat_params = { config: @config, larger_better: true, rest_on_average: :average }
          result = BenchmarkDriver::Repeater.with_repeat(**repeat_params) do
            run_benchmark(job, context: context)
          end
          value, duration = result.value
          @output.with_context(name: context.name, executable: context.executable, gems: context.gems, prelude: context.prelude) do
            @output.report(
              values: { metric => value },
              all_values: { metric => result.all_values },
              duration: duration,
              loop_count: job.loop_count,
            )
          end
        end
      end
    end
  end
end