Expand description
Self-process resource sampling — RSS (resident memory) and CPU%.
Linux-only via /proc/self/{status,stat} so no extra deps. macOS /
Windows return ProcessStats::unsupported() (rss=0, cpu=None); the
dashboard renders the rss tile blank-with-note on those platforms.
CPU% is computed across calls by stashing the previous (wall_instant,
process_ticks) sample in a process-global OnceLock<Mutex<...>> and
taking the delta. First call returns cpu_percent = None since
there’s no baseline yet; the first refresh after gateway boot fills
it in.
Structs§
Functions§
- sample
- Sample current RSS + CPU%. Cheap to call (single /proc read on Linux). Safe to call from any thread.