Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record load averages before and after benchmarking #274

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading