Skip to content

Commit 3c21aea

Browse files
Update harness API to match harness-ractor
Co-Authored-By: Luke Gruber <[email protected]>
1 parent 39c0c9d commit 3c21aea

File tree

10 files changed

+14
-15
lines changed

10 files changed

+14
-15
lines changed

harness-bips/harness.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
puts RUBY_DESCRIPTION
55

6-
def run_benchmark(_, &block)
6+
def run_benchmark(_, **, &block)
77
Benchmark.ips do |x|
88
x.report 'benchmark', &block
99
end
10+
return_results([], [1.0])
1011
end

harness-continuous/harness.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
puts RUBY_DESCRIPTION
44

5-
def run_benchmark(_)
5+
def run_benchmark(n, **, &blk)
66
iterations = 1
77
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
88

99
loop do
10-
iterations.times do
11-
yield
12-
end
10+
iterations.times(&blk)
1311

1412
end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
1513
round_time = end_time - start_time

harness-mplr/harness.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
puts RUBY_DESCRIPTION
1111

1212
# Takes a block as input
13-
def run_benchmark(_num_itrs_hint)
13+
def run_benchmark(_num_itrs_hint, **, &blk)
1414
times = []
1515
total_time = 0
1616
num_itrs = 0

harness-once/harness.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
require_relative '../harness/harness-common'
99

10-
def run_benchmark(_hint)
10+
def run_benchmark(_hint, **)
1111
yield
1212
return_results([], [0.001]) # bogus timing
1313
end

harness-perf/harness.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# the number of benchmark iterations. For example, if the default harness runs
2121
# 10 benchmark iterations (after 15 warmup iterations) for a benchmark with
2222
# the default MIN_BENCH_TIME, the benchmark should have 10 as `num_itrs_hint`.
23-
def run_benchmark(num_itrs_hint)
23+
def run_benchmark(num_itrs_hint, **, &blk)
2424
warmup_itrs = Integer(ENV.fetch('WARMUP_ITRS', 10))
2525
bench_itrs = Integer(ENV.fetch('MIN_BENCH_ITRS', num_itrs_hint))
2626

harness-stackprof/harness.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def stackprof_opts
6161
opts
6262
end
6363

64-
def run_benchmark(n, &block)
64+
def run_benchmark(n, **, &block)
6565
require "stackprof"
6666

6767
opts = stackprof_opts

harness-stats/harness.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Using Module#prepend to enable TracePoint right before #run_benchmark
44
# while also reusing the original implementation.
55
self.singleton_class.prepend Module.new {
6-
def run_benchmark(*)
6+
def run_benchmark(n, **, &block)
77
frames = []
88
c_calls = Hash.new { 0 }
99
c_blocks = Hash.new { 0 }
@@ -43,7 +43,7 @@ def run_benchmark(*)
4343

4444
method_trace.enable
4545
block_trace.enable
46-
super
46+
super(n, &block)
4747
ensure
4848
block_trace.disable
4949
method_trace.disable

harness-vernier/harness.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
ensure_global_gem("vernier")
1313
ensure_global_gem_exe("profile-viewer")
1414

15-
def run_benchmark(n, &block)
15+
def run_benchmark(n, **kwargs, &block)
1616
require "vernier"
1717

1818
out = output_file_path(ext: "json")
1919
Vernier.profile(out: out) do
20-
run_enough_to_profile(n, &block)
20+
run_enough_to_profile(n, **kwargs, &block)
2121
end
2222

2323
puts "Vernier profile:\n#{out}"

harness-warmup/harness.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def print_stats(bench, elapsed)
3333
end
3434

3535
# Takes a block as input
36-
def run_benchmark(num_itrs_hint)
36+
def run_benchmark(num_itrs_hint, **)
3737
start = monotonic_time
3838
times = []
3939

harness/harness.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def realtime
3232
end
3333

3434
# Takes a block as input
35-
def run_benchmark(_num_itrs_hint, &block)
35+
def run_benchmark(_num_itrs_hint, **, &block)
3636
times = []
3737
total_time = 0
3838
num_itrs = 0

0 commit comments

Comments
 (0)