@@ -59,7 +59,7 @@ def have_yjit?(ruby)
5959end
6060
6161# Disable Turbo Boost while running benchmarks. Maximize the CPU frequency.
62- def set_bench_config ( turbo :)
62+ def set_bench_config ( turbo :, benchmark_mode : )
6363 # sudo requires the flag '-S' in order to take input from stdin
6464 if File . exist? ( '/sys/devices/system/cpu/intel_pstate' ) # Intel
6565 unless intel_no_turbo? || turbo
@@ -76,7 +76,7 @@ def set_bench_config(turbo:)
7676 check_call ( "sudo -S cpupower frequency-set -g performance" ) unless performance_governor?
7777 end
7878
79- if os == :linux && ENV [ "BENCHMARK_MODE" ] != '0'
79+ if os == :linux && benchmark_mode
8080 BenchmarkMode . engage! &.then do |cpu |
8181 ENV [ "YJIT_BENCH_CPU" ] = cpu . to_s
8282 end
@@ -330,6 +330,7 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
330330 name_filters : [ ] ,
331331 rss : false ,
332332 graph : false ,
333+ benchmark_mode : true ,
333334 no_pinning : false ,
334335 turbo : false ,
335336} )
@@ -423,6 +424,10 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
423424 args . graph = true
424425 end
425426
427+ opts . on ( "--no-benchmark-mode" , "Disable cpusets, niceness, hyper-threading toggling" ) do
428+ args . benchmark_mode = false
429+ end
430+
426431 opts . on ( "--no-pinning" , "don't pin ruby to a specific CPU core" ) do
427432 args . no_pinning = true
428433 end
@@ -447,8 +452,8 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
447452 end
448453end
449454
450- # Disable CPU frequency scaling
451- set_bench_config ( turbo : args . turbo )
455+ # Disable CPU frequency scaling, enable cpusets, etc
456+ set_bench_config ( turbo : args . turbo , benchmark_mode : args . benchmark_mode )
452457
453458# Check pstate status
454459check_pstate ( turbo : args . turbo )
0 commit comments