1
Fork 0

Merge commit '6d35b4c9a0' into sync_cg_clif-2024-09-22

This commit is contained in:
bjorn3 2024-09-23 11:20:46 +00:00
commit b40fe1ee28
31 changed files with 487 additions and 347 deletions

View file

@ -1,11 +1,12 @@
use std::env;
use std::io::Write;
use std::path::Path;
use std::process::Command;
use crate::path::{Dirs, RelPath};
use crate::prepare::GitRepo;
use crate::rustc_info::get_file_name;
use crate::utils::{Compiler, hyperfine_command, spawn_and_wait};
use crate::utils::{Compiler, spawn_and_wait};
static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
"ebobby",
@ -128,3 +129,37 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
gha_step_summary.write_all(b"\n").unwrap();
}
}
#[must_use]
fn hyperfine_command(
warmup: u64,
runs: u64,
prepare: Option<&str>,
cmds: &[(&str, &str)],
markdown_export: &Path,
) -> Command {
let mut bench = Command::new("hyperfine");
bench.arg("--export-markdown").arg(markdown_export);
if warmup != 0 {
bench.arg("--warmup").arg(warmup.to_string());
}
if runs != 0 {
bench.arg("--runs").arg(runs.to_string());
}
if let Some(prepare) = prepare {
bench.arg("--prepare").arg(prepare);
}
for &(name, cmd) in cmds {
if name != "" {
bench.arg("-n").arg(name);
}
bench.arg(cmd);
}
bench
}