From 5f7390d79f35d3ba32d6c941914aad397680e708 Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Tue, 18 Jun 2024 08:00:53 -0700 Subject: [PATCH] Record load averages before and after benchmarking In case we might ever observe that the system was busier than expected. --- basic_benchmark.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/basic_benchmark.rb b/basic_benchmark.rb index 1610f0bc3..2d78888d7 100755 --- a/basic_benchmark.rb +++ b/basic_benchmark.rb @@ -543,6 +543,13 @@ def write_crash_file(error_info, crash_report_dir) error_info[:crash_files].each { |f| FileUtils.mv f, "#{crash_report_dir}/" } end +def load_averages + file = '/proc/loadavg' + File.readable?(file) ? File.read(file).strip : `uptime`.match(/load averages?: ([0-9., ]+)/)[1].gsub(/,/, '') +end + +load_averages_before = load_averages + Dir.chdir(YJIT_BENCH_DIR) do all_runs.each.with_index do |(run_num, config, bench_info), progress_idx| Benchmark.realtime do @@ -661,6 +668,8 @@ def write_crash_file(error_info, crash_report_dir) "total_bench_seconds" => total_seconds, "git_versions" => GIT_VERSIONS, # yjit-metrics version, yjit-bench version, etc. "ruby_config_opts" => ruby_config_opts, # command-line options for each Ruby configuration + "load_before" => load_averages_before, + "load_after" => load_averages, } json_path = OUTPUT_DATA_PATH + "/#{timestamp}_basic_benchmark_#{config}.json"