Skip to main content

Module procs

Module procs 

Source
Expand description

The host’s processes for Tower (fsproto::Request::Procs, SPEC_TOWER_TASK_MANAGER_PANE_2026_10_08.md §8): sampled here, on the host, with the same readers srv uses locally (agentmux_procstats), so only a small frame crosses the link.

  • Small: the top busiest by CPU and the top largest by memory (the union, at most 2 × top rows), plus totals for all of them. A filter is applied here first, so a search finds a process that isn’t in either top list.
  • No command lines. Names only: a command line can hold a secret, and never leaves the host through this.
  • Rates on the host: CPU is the change since the previous Procs on this connection, so nothing but the frame is sent and srv keeps no per-host state.

PaneProcs (a terminal’s stats badge, SPEC_TERMINAL_STATS_BADGE_REMOTE_PANES_2026_10_12.md) sums one AgentMux pane’s processes from the same measurement: the tree under a durable session’s shell, or, for a WSL or plain SSH pane, every process whose environment holds AGENTMUX_BLOCKID=<pane> and what those started. Each process’s environment is read once (Linux: /proc/<pid>/environ, the user’s own processes only) and remembered while it runs.

Structs§

Sampler
One connection’s sampler: the previous round’s CPU times, and the last measurement for requests that arrive within REUSE_WITHIN of it.

Constants§

MAX_PANE_PROCS
Most processes one pane’s tree counts (as srv’s badge does for a local pane): a fork bomb shouldn’t stall a sample.
MAX_TOP
Most rows per list a request may ask for.
REUSE_WITHIN
A request this soon after the last measurement reuses it (with its own filter): two Tower panes on one host, whatever their filters, must not shrink each other’s CPU window to milliseconds.

Functions§

pane_frame
A pane’s frame: roots and every process under them (at most MAX_PANE_PROCS), with the host’s totals. The earliest-started root is the pane’s shell: its name comes first and its start is the pane’s.
select
The frame for procs (with each one’s CPU rate, fraction of one core): totals over all of them, rows for the busiest and largest that match.