Skip to main content

Crate agentmux_procstats

Crate agentmux_procstats 

Source
Expand description

Per-process CPU and memory, read without elevation (SPEC_TOWER_TASK_MANAGER_PANE_2026_10_08.md §3, §4).

One snapshot lists every process this user may see, with what the OS reports for it:

OSSourceOther users’ processes
Windowsone NtQuerySystemInformation(SystemProcessInformation) callfull (no per-process handle is opened)
Linux/proc/<pid>/stat + statusfull, unless /proc is mounted hidepid
macOSproc_listallpids + proc_pid_rusagename and parent only: CPU and memory are None

Nothing here asks for a privilege: no SeDebugPrivilege, no task_for_pid, no CAP_SYS_PTRACE. A value the OS won’t give us is None, never 0.

CPU is a cumulative time; RateMeter turns two samples into a rate.

Structs§

ProcInfo
One process, as the OS reported it at the moment of the snapshot.
ProcKey
A process’s identity across snapshots.
RateMeter
Turns cumulative CPU times into rates: the fraction of one core used since the previous round (1.0 = one core fully busy).

Constants§

MEMORY_METRIC

Functions§

base_name
The executable name in a path, without directory (either separator).
command_line
A process’s full command line, read on demand (it may hold secrets, so it is never part of a snapshot). None when it has exited or the OS won’t say.
command_line_of
The command line of exactly the process key names: None if it has exited or a newer process has its PID, checked both before and after the read, so a PID reused in between never hands back the successor’s line.
cpu_count
Logical CPUs on the whole machine — what “percent of the machine” divides by (every processor group on Windows).
is_running
Whether the process key names is still the one running under its PID (it hasn’t exited, and no newer process has reused the PID). Check it before and after reading anything about a process by PID.
snapshot
Every process this user may see. Processes that exit mid-read are left out.