Sha256: 59ffbe0c879dd039c02840456ae915515ae22fc717d59fc93e63f0d7ee6589e4

Contents?: true

Size: 592 Bytes

Versions: 21

Compression:

Stored size: 592 Bytes

Contents

class Benchmark::Driver::RepeatableRunner
  # @param [Benchmark::Driver::Configuration::Job] job
  def initialize(job)
    @job = job
  end

  # @param [Integer] repeat_count
  # @param [Proc] runner - should take (job, unit_iters) and return duration.
  # @return [Benchmark::Driver::BenchmarkResult]
  def run(repeat_count:, runner:)
    real_times = (repeat_count || 1).times.map do
      runner.call(@job, @job.loop_count)
    end
    Benchmark::Driver::BenchmarkResult.new(@job).tap do |result|
      result.real = real_times.select { |d| d > 0 }.min || real_times.max
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
benchmark_driver-0.8.6 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.8.5 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.8.4 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.8.3 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.8.2 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.8.1 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.8.0 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.7.2 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.7.1 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.7.0 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.6.2 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.6.1 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.6.0 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.5.1 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.5.0 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.4.5 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.4.4 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.4.3 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.4.2 lib/benchmark/driver/repeatable_runner.rb
benchmark_driver-0.4.1 lib/benchmark/driver/repeatable_runner.rb