From 88ae8fc9c84a87d260157de72fe399d7e7e4a917 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 11 Feb 2023 13:13:38 +0000 Subject: [PATCH] Allow passing more than two commands to benchmark to hyperfine_command --- build_system/bench.rs | 8 +++++--- build_system/utils.rs | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build_system/bench.rs b/build_system/bench.rs index a9a851d0a8a..978bac8cfe2 100644 --- a/build_system/bench.rs +++ b/build_system/bench.rs @@ -80,7 +80,7 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) { ); let bench_compile = - hyperfine_command(1, bench_runs, Some(&clean_cmd), &llvm_build_cmd, &clif_build_cmd); + hyperfine_command(1, bench_runs, Some(&clean_cmd), &[&llvm_build_cmd, &clif_build_cmd]); spawn_and_wait(bench_compile); @@ -95,8 +95,10 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) { 0, bench_runs, None, - Path::new(".").join(get_file_name("raytracer_cg_llvm", "bin")).to_str().unwrap(), - Path::new(".").join(get_file_name("raytracer_cg_clif", "bin")).to_str().unwrap(), + &[ + Path::new(".").join(get_file_name("raytracer_cg_llvm", "bin")).to_str().unwrap(), + Path::new(".").join(get_file_name("raytracer_cg_clif", "bin")).to_str().unwrap(), + ], ); bench_run.current_dir(RelPath::BUILD.to_path(dirs)); spawn_and_wait(bench_run); diff --git a/build_system/utils.rs b/build_system/utils.rs index abc5bab4942..8928ed7cd56 100644 --- a/build_system/utils.rs +++ b/build_system/utils.rs @@ -162,8 +162,7 @@ pub(crate) fn hyperfine_command( warmup: u64, runs: u64, prepare: Option<&str>, - a: &str, - b: &str, + cmds: &[&str], ) -> Command { let mut bench = Command::new("hyperfine"); @@ -179,7 +178,7 @@ pub(crate) fn hyperfine_command( bench.arg("--prepare").arg(prepare); } - bench.arg(a).arg(b); + bench.args(cmds); bench }