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

Function ensure_linux_profiling_sysctls

src/executor/helpers/linux_sysctl.rs:38–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36}
37
38pub fn ensure_linux_profiling_sysctls() -> Result<Vec<LinuxSysctl>> {
39 if !cfg!(target_os = "linux") {
40 return Ok(Vec::new());
41 }
42
43 let mut sysctls = Vec::new();
44
45 for (name, target_value) in [
46 ("kernel.kptr_restrict", 0),
47 ("kernel.perf_event_paranoid", -1),
48 ] {
49 let sysctl = LinuxSysctl::set(name, target_value)?;
50 if sysctl.is_changed() {
51 sysctls.push(sysctl);
52 }
53 }
54
55 Ok(sysctls)
56}
57
58/// Sets a sysctl, returning the value it held before, or `None` when it was
59/// already at `target_value` and nothing was written.

Callers 1

setupMethod · 0.85

Calls 2

setFunction · 0.85
is_changedMethod · 0.80

Tested by

no test coverage detected