mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Improve benchmarking step summary format
This commit is contained in:
parent
448b7a3a12
commit
84afcee743
@ -73,14 +73,18 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
|||||||
1,
|
1,
|
||||||
bench_runs,
|
bench_runs,
|
||||||
Some(&clean_cmd),
|
Some(&clean_cmd),
|
||||||
&[&llvm_build_cmd, &clif_build_cmd, &clif_build_opt_cmd],
|
&[
|
||||||
|
("cargo build", &llvm_build_cmd),
|
||||||
|
("cargo-clif build", &clif_build_cmd),
|
||||||
|
("cargo-clif build --release", &clif_build_opt_cmd),
|
||||||
|
],
|
||||||
&bench_compile_markdown,
|
&bench_compile_markdown,
|
||||||
);
|
);
|
||||||
|
|
||||||
spawn_and_wait(bench_compile);
|
spawn_and_wait(bench_compile);
|
||||||
|
|
||||||
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
|
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
|
||||||
gha_step_summary.write_all(b"# Compilation\n\n").unwrap();
|
gha_step_summary.write_all(b"## Compile ebobby/simple-raytracer\n\n").unwrap();
|
||||||
gha_step_summary.write_all(&std::fs::read(bench_compile_markdown).unwrap()).unwrap();
|
gha_step_summary.write_all(&std::fs::read(bench_compile_markdown).unwrap()).unwrap();
|
||||||
gha_step_summary.write_all(b"\n").unwrap();
|
gha_step_summary.write_all(b"\n").unwrap();
|
||||||
}
|
}
|
||||||
@ -89,23 +93,29 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
|||||||
|
|
||||||
let bench_run_markdown = RelPath::DIST.to_path(dirs).join("bench_run.md");
|
let bench_run_markdown = RelPath::DIST.to_path(dirs).join("bench_run.md");
|
||||||
|
|
||||||
|
let raytracer_cg_llvm = Path::new(".").join(get_file_name(
|
||||||
|
&bootstrap_host_compiler.rustc,
|
||||||
|
"raytracer_cg_llvm",
|
||||||
|
"bin",
|
||||||
|
));
|
||||||
|
let raytracer_cg_clif = Path::new(".").join(get_file_name(
|
||||||
|
&bootstrap_host_compiler.rustc,
|
||||||
|
"raytracer_cg_clif",
|
||||||
|
"bin",
|
||||||
|
));
|
||||||
|
let raytracer_cg_clif_opt = Path::new(".").join(get_file_name(
|
||||||
|
&bootstrap_host_compiler.rustc,
|
||||||
|
"raytracer_cg_clif_opt",
|
||||||
|
"bin",
|
||||||
|
));
|
||||||
let mut bench_run = hyperfine_command(
|
let mut bench_run = hyperfine_command(
|
||||||
0,
|
0,
|
||||||
bench_runs,
|
bench_runs,
|
||||||
None,
|
None,
|
||||||
&[
|
&[
|
||||||
Path::new(".")
|
("", raytracer_cg_llvm.to_str().unwrap()),
|
||||||
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_llvm", "bin"))
|
("", raytracer_cg_clif.to_str().unwrap()),
|
||||||
.to_str()
|
("", raytracer_cg_clif_opt.to_str().unwrap()),
|
||||||
.unwrap(),
|
|
||||||
Path::new(".")
|
|
||||||
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif", "bin"))
|
|
||||||
.to_str()
|
|
||||||
.unwrap(),
|
|
||||||
Path::new(".")
|
|
||||||
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif_opt", "bin"))
|
|
||||||
.to_str()
|
|
||||||
.unwrap(),
|
|
||||||
],
|
],
|
||||||
&bench_run_markdown,
|
&bench_run_markdown,
|
||||||
);
|
);
|
||||||
@ -113,7 +123,7 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
|||||||
spawn_and_wait(bench_run);
|
spawn_and_wait(bench_run);
|
||||||
|
|
||||||
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
|
if let Some(gha_step_summary) = gha_step_summary.as_mut() {
|
||||||
gha_step_summary.write_all(b"# Execution\n\n").unwrap();
|
gha_step_summary.write_all(b"## Run ebobby/simple-raytracer\n\n").unwrap();
|
||||||
gha_step_summary.write_all(&std::fs::read(bench_run_markdown).unwrap()).unwrap();
|
gha_step_summary.write_all(&std::fs::read(bench_run_markdown).unwrap()).unwrap();
|
||||||
gha_step_summary.write_all(b"\n").unwrap();
|
gha_step_summary.write_all(b"\n").unwrap();
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ pub(crate) fn hyperfine_command(
|
|||||||
warmup: u64,
|
warmup: u64,
|
||||||
runs: u64,
|
runs: u64,
|
||||||
prepare: Option<&str>,
|
prepare: Option<&str>,
|
||||||
cmds: &[&str],
|
cmds: &[(&str, &str)],
|
||||||
markdown_export: &Path,
|
markdown_export: &Path,
|
||||||
) -> Command {
|
) -> Command {
|
||||||
let mut bench = Command::new("hyperfine");
|
let mut bench = Command::new("hyperfine");
|
||||||
@ -156,7 +156,12 @@ pub(crate) fn hyperfine_command(
|
|||||||
bench.arg("--prepare").arg(prepare);
|
bench.arg("--prepare").arg(prepare);
|
||||||
}
|
}
|
||||||
|
|
||||||
bench.args(cmds);
|
for &(name, cmd) in cmds {
|
||||||
|
if name != "" {
|
||||||
|
bench.arg("-n").arg(name);
|
||||||
|
}
|
||||||
|
bench.arg(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
bench
|
bench
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user