Skip to main content

Module sampler

Module sampler 

Source
Expand description

Tower: CPU and memory per task, for the read-only task manager pane (SPEC_TOWER_TASK_MANAGER_PANE_2026_10_08.md).

A task is a pane and every process it started, plus one more for AgentMux itself. Each sample takes one process snapshot (agentmux_procstats) and groups it:

  1. The pane’s tracker (process_tracker): a Job Object or cgroup on an agent, which nothing it starts can leave; a best-effort scan on macOS.
  2. The pane’s process tree where there is no tracker membership (a terminal on Linux or macOS): descendants of its shell.
  3. Sticky membership: a process seen in a task stays in it until it exits, even after it is reparented away from the tree.
  4. AgentMux: the backend’s own ancestry while it is AgentMux’s (launcher, window host) and everything under it no task claimed.

Sampling is driven by the pane (tower.sample): nothing runs while no Tower is open, and two panes asking at once share a sample.

Structs§

BlockLabel
How a block is named and what kind of task it is.
Inputs
What the sampler is told about the panes.
Tower
The process-wide sampler. Its state is the previous sample (for CPU rates) and sticky membership.

Constants§

AGENTMUX_TASK_ID
TowerTask::id of AgentMux’s own processes.
INTERVAL
How often the pane asks while it is visible.
SHARED_TOP
Rows a snapshot sent to another machine carries per list (busiest, largest), as a remote frame does (agentmux_remote::procs).

Functions§

block_label
A pane’s name in Tower and on its stats badge: the agent’s name, else what the terminal runs. None for a block that no longer exists.
share
Make a snapshot fit to send to a paired device: drop the tasks hidden names (an agent hidden from paired devices) and their processes, keep the host rows matching every word of filter, then only the top busiest and top largest of those. Totals keep counting every process.