Skip to content

Commit 729bcf9

Browse files
committed
add new RUBY_BENCH_CMD_PREFIX option
If you want to run `perf` during the benchmark run, but you don't want to record any non-benchmark code, there is currently no way to do this outside of the perf harness. The perf harness has the downside that it only works with perf, and not with samply or other profilers. RUBY_BENCH_CMD_PREFIX="perf record -g" ./run_benchmarks.rb --chruby="head::ruby_head --yjit --yjit-perf=map" railsbench You can use any command you want, so it's not limited to perf: RUBY_BENCH_CMD_PREFIX="samply record" ./run_benchmarks.rb --chruby="head::ruby_head --yjit" railsbench Note that unlike the perf harness, this wraps the entire benchmark run with the command, so even warmup iterations are recorded. This option can be used with any command, so it's not limited to profiling. You can currently run perf or samply by running the benchmark directly, but it's useful to go through `run_benchmarks.rb` option processing and chruby switching.
1 parent 7361542 commit 729bcf9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎lib/benchmark_suite.rb‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ def run_single_benchmark(script_path, result_json_path, ruby, cmd_prefix, env, b
157157
# Use per-benchmark default_harness if set, otherwise use global harness
158158
benchmark_harness = benchmark_harness_for(benchmark_name)
159159

160+
161+
if prefix = ENV["RUBY_BENCH_CMD_PREFIX"]
162+
cmd_prefix = prefix.shellsplit + cmd_prefix
163+
end
164+
160165
# Set up the benchmarking command
161166
cmd = cmd_prefix + [
162167
*ruby,

0 commit comments

Comments
 (0)