Skip to content

Commit 31b5b56

Browse files
committed
[GR-26172] Fix the --fixed-iterations harness when there are multiple benchmarks in a file
PullRequest: truffleruby/2068
2 parents 47ec1d3 + 1751c8f commit 31b5b56

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

bench/benchmark-interface/lib/benchmark-interface/backends/fixed-iterations.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ def self.run(benchmark_set, names, options)
1818
print_iterations = options['--iterations']
1919
elapsed = options['--elapsed']
2020
print_ips = options['--ips']
21-
22-
fixed_iterations = options['--fixed-iterations'].sort
23-
total_iterations = fixed_iterations.last
21+
fixed_iterations = options['--fixed-iterations'].sort.freeze
2422

2523
benchmark_set.benchmarks(names).each do |benchmark|
2624
puts benchmark.name
2725
block = benchmark.block
2826

29-
next_iter = fixed_iterations.shift
27+
iterations = fixed_iterations.dup
28+
total_iterations = fixed_iterations.last
29+
30+
next_iter = iterations.shift
3031
start_time = get_time
3132
(1..total_iterations).each do |iter|
3233
block.call
@@ -37,7 +38,7 @@ def self.run(benchmark_set, names, options)
3738
puts since_start if elapsed
3839
puts iter / since_start if print_ips
3940

40-
next_iter = fixed_iterations.shift
41+
next_iter = iterations.shift
4142
end
4243
end
4344
end

0 commit comments

Comments
 (0)