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

Function wrap_isolation_scope

src/executor/wall_time/isolation.rs:57–73  ·  view source on GitHub ↗
(mut bench_cmd: CommandBuilder)

Source from the content-addressed store, hash-verified

55/// spawned scope inherit it.
56#[cfg(target_os = "linux")]
57pub fn wrap_isolation_scope(mut bench_cmd: CommandBuilder) -> Result<CommandBuilder> {
58 use crate::executor::helpers::env::is_codspeed_debug_enabled;
59
60 let mut cmd_builder = CommandBuilder::new("systemd-run");
61 if !is_codspeed_debug_enabled() {
62 cmd_builder.arg("--quiet");
63 }
64 cmd_builder.arg("--slice=codspeed.slice");
65 cmd_builder.arg("--scope");
66 cmd_builder.arg("--same-dir");
67 cmd_builder.arg(format!("--uid={}", nix::unistd::Uid::current().as_raw()));
68 cmd_builder.arg(format!("--gid={}", nix::unistd::Gid::current().as_raw()));
69 cmd_builder.args(["--"]);
70
71 bench_cmd.wrap_with(cmd_builder);
72 Ok(bench_cmd)
73}
74
75/// Dummy implementation on non-Linux platforms: the benchmark command is returned as-is.
76// TODO(COD-2513): implement an equivalent process-isolation mechanism on macOS

Callers 1

runMethod · 0.85

Calls 4

argMethod · 0.80
argsMethod · 0.80
wrap_withMethod · 0.80

Tested by

no test coverage detected