Skip to main content

Module system_monitor

Module system_monitor 

Source

Functions§

emit_jemalloc_stats
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.
emit_process_memory_stats
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.
send_system_metrics_forever
Continuously sends system-wide CPU and memory usage metrics.
should_sample_slow
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.
spawn_system_monitor
Spawns a new thread to run the send_system_metrics_forever function.