MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / bench_cmd

Method bench_cmd

src/executor/analysis/executor.rs:43–67  ·  view source on GitHub ↗
(
        &self,
        execution_context: &ExecutionContext,
        instruments_env: HashMap<String, String>,
    )

Source from the content-addressed store, hash-verified

41 }
42
43 fn bench_cmd(
44 &self,
45 execution_context: &ExecutionContext,
46 instruments_env: HashMap<String, String>,
47 ) -> Result<(NamedTempFile, NamedTempFile, CommandBuilder)> {
48 let config = &execution_context.config;
49 let mut extra_env =
50 get_base_injected_env(self.mode.clone(), &execution_context.profile_folder, config);
51 extra_env.insert("PATH".into(), build_path_env(config.enable_introspection)?);
52 extra_env.extend(instruments_env);
53
54 // Written to a script to keep the command's formatting without escaping it.
55 let mut script_file = NamedTempFile::new()?;
56 script_file.write_all(get_bench_command(config)?.as_bytes())?;
57
58 let mut bench_cmd = CommandBuilder::new("bash");
59 bench_cmd.arg(script_file.path());
60 let (mut bench_cmd, env_file) = wrap_with_env(bench_cmd, &extra_env)?;
61
62 if let Some(cwd) = &config.working_directory {
63 bench_cmd.current_dir(canonicalize(cwd)?);
64 }
65
66 Ok((env_file, script_file, bench_cmd))
67 }
68}
69
70#[async_trait(?Send)]

Callers 1

runMethod · 0.80

Calls 7

get_base_injected_envFunction · 0.85
build_path_envFunction · 0.85
get_bench_commandFunction · 0.85
wrap_with_envFunction · 0.85
argMethod · 0.80
pathMethod · 0.80
current_dirMethod · 0.80

Tested by

no test coverage detected