Engineering story
Building a process monitor
Read the proctop engineering story.
Linux process monitor
proctop watches one process and its descendants and records CPU and memory over time. Follow a live TUI graph or stream plain, colored, or JSON samples; peaks and a summary are tracked on exit.
go install codeberg.org/ubunatic/proctop@latestProject snapshot · measured 2026-10-26
| Week starting | Commits |
|---|---|
| 2026-08-03 | 2 |
| 2026-08-10 | 0 |
| 2026-08-17 | 0 |
| 2026-08-24 | 3 |
| 2026-08-31 | 1 |
| 2026-09-07 | 0 |
| 2026-09-14 | 0 |
| 2026-09-21 | 0 |
| 2026-09-28 | 0 |
| 2026-10-05 | 1 |
| 2026-10-12 | 0 |
| 2026-10-19 | 0 |
Go 1.26.5, Cobra, x/term, YAML + JSON Schema, Linux /proc, GoReleaser
Recorded TUI frame
This frame was captured after twelve minutes of recording. The display is paused while sampling continues; the cursor is parked on a sample and two spans carry notes.
proctop — firefox (pid 202378, 24 procs) ⏸ paused (still recording) · interval 1s · elapsed 12:10
CPU 23.0% min 15.0% max 178.5% @17:07:49
▁ █
█▆▇▆ █
▄████ ▁ ▄▂ █
▂▁▂▂▂▁▂▃▁ █▁▂▁▁▅▁▃▁ ▃▁▃▁▁▁▆▃▂ ▂ ▄▃█████▆▆▄▇█▂▂▁▃▂▂▁▃▂▃▂▃▄▃▂▁▄▂▃▂▃▂▃▂▁▃█▁▁▄▂▃▃██ █ ▆
█████████████████████████████████████████████████████████████████████████████████████████████████
MEM 3.4GiB min 3.3GiB max 3.8GiB @17:10:33
██████████▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇███████████▇▇▇█████████████████████▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▆▆▆▆▆▅▅▅▅▅▆▆▅
██████████████████████████████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████████████████████████████
▶ 17:08:01 cpu 27.0% mem 3.3GiB
● 17:06:57–17:07:03 cpu 0.0% mem 0B — note 1
● 17:07:46–17:07:51 cpu 0.0% mem 0B — note 2
Features
Follows every descendant and rediscovers the tree every tick, including processes that fork later.
CPU and RSS sparklines with running minimum, maximum and peak timestamps.
Plain, colored and JSON samples; piping output switches to stream mode automatically.
CPU and memory min, max and average, with peak timestamps, printed on exit or appended to JSON.
Pause, scroll history, mark a span with v, and annotate with a; annotations appear in the JSON summary.
Press s to save the current frame as plain .txt and colored .ansi files.
Usage
proctop [flags] <name|pid> accepts exactly one target. A process name resolves to the topmost match with the largest subtree.
proctop firefox # live TUI graph (q to quit)
proctop 4242 # watch by PID
proctop -f plain firefox # stream one line per second
proctop -f json firefox # JSON lines for machine consumption
proctop -o usage.log -s summary.json firefox
| Flag | Default | Description |
|---|---|---|
-i, --interval |
1s |
Sampling interval |
-f, --format |
color |
plain, color, or json stream format |
-o, --out |
— | Append per-sample lines to this file |
-s, --summary |
— | Append a JSON summary on exit |
-n, --history |
300 |
Samples kept for graph and history |
--stream |
false |
Print samples instead of the TUI |
TUI keys
.txt and .ansi files.How it works
Reads /proc/<pid>/stat for each process once per interval; no ptrace, kernel module, or elevated privileges are needed for your own processes.
Uses deltas of utime + stime ticks, as a percentage of one core summed across the tree; multi-core trees can exceed 100%.
Sums resident-set pages converted to bytes. Shared pages are counted per process, so treat the tree total as an upper bound.
Install
Requires Go 1.26 or newer. proctop is Linux-only because it reads /proc.
go install codeberg.org/ubunatic/proctop@latest
# or from a clone
git clone https://codeberg.org/ubunatic/proctop
cd proctop && make install
Engineering story
Read the proctop engineering story.
Architecture
Engineering story
A process monitor usually answers one narrow question: what is using resources right now? proctop was built to answer a more useful debugging question: how did one application and all of its child processes behave over time? It watches CPU…
Read the engineering story