Skip to content

Commit

Permalink
Merge pull request #274 from Shopify/rwstauner/loadavg
Browse files Browse the repository at this point in the history
Record load averages before and after benchmarking
  • Loading branch information
maximecb committed Jun 19, 2024
2 parents 0a56fc1 + 5f7390d commit 678b0b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions basic_benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 678b0b1

Please sign in to comment.