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

Method build_memtrack_command

src/executor/memory/executor.rs:39–74  ·  view source on GitHub ↗
(
        execution_context: &ExecutionContext,
    )

Source from the content-addressed store, hash-verified

37
38impl MemoryExecutor {
39 fn build_memtrack_command(
40 execution_context: &ExecutionContext,
41 ) -> Result<(MemtrackIpcServer, CommandBuilder, NamedTempFile)> {
42 let mut extra_env = get_base_injected_env(
43 RunnerMode::Memory,
44 &execution_context.profile_folder,
45 &execution_context.config,
46 );
47
48 extra_env.insert(
49 "PATH".into(),
50 build_path_env(execution_context.config.enable_introspection)?,
51 );
52
53 // Setup memtrack IPC server
54 let (ipc_server, server_name) = ipc::IpcOneShotServer::new()?;
55
56 // Build the memtrack command
57 let mut cmd_builder = CommandBuilder::new(MEMTRACK_COMMAND);
58 cmd_builder.arg("track");
59 cmd_builder.arg("--output");
60 cmd_builder.arg(execution_context.profile_folder.join("results"));
61 cmd_builder.arg("--ipc-server");
62 cmd_builder.arg(server_name);
63 cmd_builder.arg(get_bench_command(&execution_context.config)?);
64
65 // Set working directory if specified
66 if let Some(cwd) = &execution_context.config.working_directory {
67 let abs_cwd = canonicalize(cwd)?;
68 cmd_builder.current_dir(abs_cwd);
69 }
70
71 let (cmd_builder, env_file) = wrap_with_env(cmd_builder, &extra_env)?;
72
73 Ok((ipc_server, cmd_builder, env_file))
74 }
75
76 /// Ensure memtrack can load its eBPF programs: either run as root or hold the
77 /// required file capabilities. Tries a one-time capability grant if neither

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected