Skip to main content

Module sysmon

Module sysmon 

Source
Expand description

Live system-stats streamer.

sysinfo_start spawns a Monitor: a background thread that pushes a {"sys":{…}} frame every interval_ms until the connection closes or the caller sends sysinfo_stop (which drops the Monitor). Running on its own thread means the connection stays free for other RPCs — a HUD can stream stats and run a shell over the same pipe.

Structs§

Monitor
A running stats stream. Dropping it stops the thread and joins it.

Functions§

snapshot
Collect one stats snapshot as a JSON object. Shared by the streamer and the one-shot sysinfo_once command. disks is passed in (rather than refreshed here) so the streamer can keep it alive across ticks — Disk::usage() reports bytes since the last refresh, so a persistent, per-tick-refreshed Disks is what turns those deltas into a real per-second I/O rate.