Resolves this process’s own cgroup cpu.stat from the contents of
/proc/self/cgroup. Without a cgroup namespace the root file would report
host-wide usage, so the 0::<path> line is followed; the root file is the
fallback when there is no v2 line.
Emits jemalloc’s own runtime accounting (stats.allocated/resident/
mapped/retained). Only meaningful when jemalloc is this process’s
global allocator, hence the feature + platform gate.
Emits this process’s own RSS/virtual memory size. Allocator-agnostic
(reads from the OS via sysinfo), so this runs for every consumer of
spawn_system_monitor, including non-jemalloc binaries.
True once at least SLOW_SAMPLE_INTERVAL has elapsed since the last slow
sample. Extracted as a pure function (mirroring saturation_monitor.rs’s
sample_once extraction) so the gating decision itself is directly
testable with plain Duration values, rather than only reachable from
inside the infinite loop below.
Converts microseconds to ticks at frequency ticks per second. Widens to u128 because a
cumulative counter times a multi-GHz frequency overflows u64 within days.