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

Function wrap_isolation_scope

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

Source from the content-addressed store, hash-verified

166/// its working directory, which `--same-dir` propagates into the scope.
167#[cfg(target_os = "linux")]
168fn wrap_isolation_scope(mut bench_cmd: CommandBuilder) -> Result<CommandBuilder> {
169 use crate::executor::helpers::env::is_codspeed_debug_enabled;
170
171 let mut cmd_builder = CommandBuilder::new("systemd-run");
172 if !is_codspeed_debug_enabled() {
173 cmd_builder.arg("--quiet");
174 }
175 cmd_builder.arg("--slice=codspeed.slice");
176 cmd_builder.arg("--scope");
177 cmd_builder.arg("--same-dir");
178 cmd_builder.arg(format!("--uid={}", nix::unistd::Uid::current().as_raw()));
179 cmd_builder.arg(format!("--gid={}", nix::unistd::Gid::current().as_raw()));
180 cmd_builder.args(["--"]);
181
182 bench_cmd.wrap_with(cmd_builder);
183 Ok(bench_cmd)
184}
185
186/// Dummy implementation on non-Linux platforms: the benchmark command is returned as-is.
187// TODO(COD-2513): implement an equivalent process-isolation mechanism on macOS

Callers 1

wrap_benchMethod · 0.85

Calls 4

argMethod · 0.80
argsMethod · 0.80
wrap_withMethod · 0.80

Tested by

no test coverage detected