diff --git a/lib/en57/benchmark.rb b/lib/en57/benchmark.rb index 6f9ee76..c9d3600 100644 --- a/lib/en57/benchmark.rb +++ b/lib/en57/benchmark.rb @@ -202,24 +202,18 @@ module En57 NOOP_MEASURE = ->(&block) { block.call } def run(measure) - warmup - reset_retry_count + @warmup_runs.times { call(NOOP_MEASURE, SecureRandom.hex(4)) } + @retry_count.value = 0 @runs.times { call(measure, SecureRandom.hex(4)) } end private - def total_runs = @runs + @warmup_runs def setup(_database_url) end def call(_measure, _run_id) end def record_retry = @retry_count.increment - def reset_retry_count = @retry_count.value = 0 - def warmup - @warmup_runs.times { call(NOOP_MEASURE, SecureRandom.hex(4)) } - end - def concurrently barrier = Concurrent::CyclicBarrier.new(@concurrency) Array diff --git a/test/test_benchmark.rb b/test/test_benchmark.rb index bed43e8..fc0aa49 100644 --- a/test/test_benchmark.rb +++ b/test/test_benchmark.rb @@ -385,28 +385,6 @@ module En57 assert_equal(3, scenario.instance_variable_get(:@batch_size)) end - def test_scenario_calculates_total_runs - scenario = - Class - .new(Scenario) do - def initialize - super( - name: "total", - database_url: "postgres://example", - runs: 2, - warmup_runs: 3, - concurrency: 1, - batch_size: 1, - ) - end - - def expose_total_runs = total_runs - end - .new - - assert_equal(5, scenario.expose_total_runs) - end - def test_scenario_defaults_to_noop_call scenario = Scenario.new(