Sha256: 8edd0a918ddb0101c322e80b4558ae4f36238909b74529a2755abf7049af61ee
Contents?: true
Size: 737 Bytes
Versions: 21
Compression:
Stored size: 737 Bytes
Contents
class Benchmark::Driver::DurationRunner # @param [Benchmark::Driver::Configuration::Job] job def initialize(job) @job = job end # @param [Integer,Float] seconds # @param [Integer] unit_iters # @param [Proc] runner - should take (job, unit_iters) and return duration. # @return [Benchmark::Driver::BenchmarkResult] def run(seconds:, unit_iters:, runner:) real_time = 0.0 iterations = 0 unit_iters = unit_iters.to_i benchmark_until = Benchmark::Driver::Time.now + seconds while Benchmark::Driver::Time.now < benchmark_until real_time += runner.call(@job, unit_iters) iterations += unit_iters end Benchmark::Driver::BenchmarkResult.new(@job, iterations, real_time) end end
Version data entries
21 entries across 21 versions & 1 rubygems