- C 96.6%
- Roff 1.6%
- Shell 0.9%
- Makefile 0.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| CHANGELOG.md | ||
| compose.yaml | ||
| DECISIONS.md | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| xptm.1 | ||
xptm
A system monitor for the Linux terminal that copies the layout, behaviour and feel of the Windows XP Task Manager: menu bar and tab strip, green-on-black history graphs and LED-style meters, the Totals / Physical Memory / Commit Charge / Kernel Memory panels, and the status bar.
It is one small C11 binary whose only dependency is ncursesw, and it uses well under 1 % CPU while it runs.
Task Manager _ □ X
File Options View Shut Down Help
┌───────────┬─────────────┬────────────┬───────┐
│ Processes │ Performance │ Networking │ Users │
├───────────┘ └────────────┴───────┴─────────────────────────────┐
│ │
│ ┌ CPU Usage ┐ ┌ CPU Usage History ──────────────────────────────────────┐ │
│ │ ░░░░░░░ │ │⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀│ │
│ │ ░░░░░░░ │ │⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒⡗⠒⠒⠒⠒⠒│ │
│ │ ░░░░░░░ │ │⣀⣀⣀⣀⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀⡴⢲⡤⣄⣀⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣠⣄⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣤⣀⣀⣀⣀⣀⣀⣀│ │
│ └─── 2% ────┘ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌ Memory ───┐ ┌ Memory Usage History ───────────────────────────────────┐ │
│ │ ░░░░░░░ │ │⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⣀│ │
│ │ ▄▄▄▄▄▄▄ │ │⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠴⠒⠒⠒⠒⠒⠒⠒⠒⠦⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ │
│ │ ███████ │ │⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠉│ │
│ └ 7 598 MB ─┘ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌ Totals ──────────────────────────┐ ┌ Physical Memory (MB) ────────────┐ │
│ │ Handles 20 618 │ │ Total 15 549 │ │
│ │ Threads 1 798 │ │ Available 7 951 │ │
│ │ Processes 535 │ │ System Cache 7 225 │ │
│ └──────────────────────────────────┘ └──────────────────────────────────┘ │
│ ┌ Commit Charge (MB) ──────────────┐ ┌ Kernel Memory (MB) ──────────────┐ │
│ │ Total 34 433 │ │ Total 788 │ │
│ │ Limit 32 350 │ │ Paged 366 │ │
│ │ Peak 34 466 │ │ Nonpaged 422 │ │
│ └──────────────────────────────────┘ └──────────────────────────────────┘ │
└────────────────────────────────────────────────────────────────────────────┘
Processes: 535 │ CPU Usage: 2% │ Memory: 7 598 MB / 15 549 MB (49%)
Features
- Processes: sortable list with 19 optional columns (Select Columns), CPU shares that add up to 100 % with the System Idle Process, type-ahead, End Process / End Process Tree with confirmation and a forced end for processes that ignore SIGTERM, Set Priority and Set Affinity.
- Performance: CPU and memory meters and history graphs, one graph per CPU, kernel times, physical memory or commit charge ("PF Usage"), and the four value panels.
- Networking: one autoscaling graph per adapter, utilisation for known link speeds and throughput for Wi-Fi, bridges and tunnels, and an adapter table.
- Users: login sessions from utmp, or from
/procwhere utmp is empty (always on musl), with Log Off and Send Message. - Full keyboard and mouse control, drop-down and context menus, tiny-footprint mode, Luna and Dark themes, braille / blocks / ascii graphs, and settings that persist between runs.
Building
You need a C compiler, make, pkg-config and the ncursesw development files:
ncurses-devel on Fedora, libncurses-dev on Debian and Ubuntu, ncurses-dev
on Alpine.
make debug links against the sanitizer runtimes; on Fedora install them with
sudo dnf install libasan libubsan.
make # ./xptm
make debug # ./xptm-debug with ASan, UBSan, -O0 -g and -Werror
make test # unit, fixture and live cross-check tests
make test BUILD=debug
make STATIC=1 # static binary; best against musl (see Docker below)
make install PREFIX=/usr/local DESTDIR=
It builds on glibc and musl, on 64-bit and 32-bit (make CFLAGS=-m32 LDFLAGS=-m32), with gcc or clang, without warnings.
Running
xptm # opens on the tab you used last
xptm -t performance -u high
xptm --theme dark --glyphs blocks
xptm --dump # every metric as key=value, then exit
xptm --bench 500 # time 500 collection ticks
Run xptm --help for all options and man xptm for the details. The terminal
must be at least 80×24; 80×30 is the size the layout was drawn for.
Keys
| Key | Action |
|---|---|
| Alt+1 … Alt+4, Ctrl+PgDn / Ctrl+PgUp | Switch tabs |
| Tab, Shift+Tab | Move between the tab strip, list, checkbox and buttons |
| F10, Alt+F / O / V / S / H | Menus |
| ↑ ↓ PgUp PgDn Home End, typing a name | Move in lists |
| F6, Shift+F6 | Next sort column, reverse the sort |
| Del, Shift+Del | End Process, End Process Tree |
| Shift+F10 or right-click | Process context menu |
| F5 | Refresh now |
| Ctrl+T, double-click a graph | Tiny-footprint mode (Esc leaves it) |
| Ctrl+Z | Suspend to the shell |
| Ctrl+Q, Ctrl+C | Quit |
The mouse works everywhere: tabs, menus, column headers (click again to reverse
the sort), rows, checkboxes, buttons, the title bar's _ □ X, and the wheel for
lists and the network graphs. --no-mouse turns it off.
The other tabs
Processes and Users below come from the basic test fixture, so their values
are fixed; Networking is fed by a changing fixture with a 1 Gbps adapter and a
Wi-Fi adapter of unknown speed.
Task Manager _ □ X
File Options View Shut Down Help
┌───────────┬─────────────┬────────────┬───────┐
│ Processes │ Performance │ Networking │ Users │
│ └─────────────┴────────────┴───────┴─────────────────────────────┐
│ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ Image Name │ User Name │CPU▼ │ Mem Usage │ │
│ ├──────────────────────────────────┴──────────────┴─────┴────────────────┤ │
│ │ System Idle Process root 100 0.0 MB │ │
│ │ init root 00 1.2 MB │ │
│ │ sshd root 00 7.8 MB │ │
│ │ sshd-session root 00 5.9 MB │ │
│ │ bash root 00 4.7 MB │ │
│ │ bash root 00 4.3 MB │ │
│ │ agetty root 00 1.6 MB │ │
│ │ firefox root 00 813.4 MB │ │
│ │ Web Content root 00 199.5 MB │ │
│ │ chrome_crashpad_handler root 00 3.5 MB │ │
│ │ (a) b) root 00 0.4 MB │ │
│ │ pipewire root 00 12.3 MB │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ │
│ [x] Show processes from all users [ End Process ] │
└────────────────────────────────────────────────────────────────────────────┘
Processes: 13 │ CPU Usage: 0% │ Memory: 6 948 MB / 15 936 MB (44%)
Task Manager _ □ X
File Options View Shut Down Help
┌───────────┬─────────────┬────────────┬───────┐
│ Processes │ Performance │ Networking │ Users │
├───────────┴─────────────┘ └───────┴─────────────────────────────┐
│ │
│ ┌ eth0 ──────────────────────────────────────────────────────────────────┐ │
│ │ 25% ⡇ ⡇ ⣀ ⣀⡇⣀ ⣀ ⣀⡇⣀ ⣀ ⣀⡇⣀ ⣀ ⣀⡇⣀ ⣀ ⣀⡇⣀ ⡇ ⡇ ⡇ ⡇ │ │
│ │ ⠒⡗⠒⠒⠒⠒⠒⢰⡆⠒⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⣿⢀⡀⠒⣶⡗⣶⠒⣶⠒⣶⡗⣶⠒⣶⠒⣶⡗⣶⠒⣶⠒⣶⡗⣶⠒⣶⠒⣶│ │
│ │ 13% ⠒⡗⠒⠒⠒⠒⠒⠉⢳⣶⣿⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⢸⣸⣷⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛⣶⠛│ │
│ │ ⠤⡧⠤⠤⠤⠤⠤⡧⠈⠙⠻⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠸⠇⠉⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤⠉⠤│ │
│ │ 0 ⡇ ⡇ ⡇ ⡇ ⡇ ⡇ ⡇ ⡇ ⡇ ⡇ ⡇ │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌ wlan0 ─────────────────────────────────────────────────────────────────┐ │
│ │200K ⡇ ⡇ ⣀ ⢀⡀ ⣀ ⢀⡀ ⡇⣀ ⡇⢀⡀ ⣀⡇ ⢀⡀ ⣀ ⢀⡀ │ │
│ │ ⠒⡗⠒⠒⠒⠒⠒⡗⢰⢻⠒⠒⡞⡇⠒⣸⡇⠒⢰⢻⠒⢀⣿⠒⠒⡞⡇⠒⣸⡇⠒⢰⢻⠒⢀⣿⠒⡗⡞⡇⠒⢰⢻⡗⢀⣿⠒⠒⡞⡇⠒⣸⡇⠒⢰⢻⠒⢀⣿⠒⠒⡞⡇⠒⣸⡇⠒│ │
│ │100K ⠒⡗⠒⠒⠒⠒⠒⢠⠏⢸⠒⡼⠁⡇⣰⠃⢧⢠⠏⢸⢀⡞⠸⡄⡼⠁⡇⣰⠃⢧⢠⠏⢸⢀⡞⠸⡄⡼⠁⡇⢠⠏⢸⢀⡞⠸⡄⡼⠁⡇⣰⠃⢧⢠⠏⢸⢀⡞⠸⡄⡼⠁⡇⣰⠃⢧⢠│ │
│ │ ⠤⡧⠤⠤⠤⠤⠤⠉⠤⢸⣰⠃⠤⣧⠇⠤⢸⡞⠤⢸⡼⠤⠤⣷⠃⡧⣧⠇⠤⢸⡞⡧⢸⡼⠤⠤⣷⠃⠤⣧⣼⠤⢸⡼⠤⠤⣷⠃⠤⣧⠇⠤⢸⡞⠤⢸⡼⠤⠤⣷⠃⡧⣧⠇⠤⢸⡞│ │
│ │ 0 ⡇ ⡇ ⠸⠇ ⠉ ⠈⠁ ⡇⠉ ⡇⠈⠁ ⡇ ⠉⠉ ⠈⠁ ⠉ ⠈⠁ ⡇⠉ │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ Adapter Name │ Network Utilization │ Link Speed │ State │ │
│ ├────────────────────┴─────────────────────┴──────────────┴──────────────┤ │
│ │ eth0 13.4 % 1 Gbps Connected │ │
│ │ wlan0 92.5 KB/s Unknown Connected │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
└────────────────────────────────────────────────────────────────────────────┘
Processes: 1 │ CPU Usage: 0% │ Memory: 1 509 MB / 3 951 MB (38%)
Task Manager _ □ X
File Options View Shut Down Help
┌───────────┬─────────────┬────────────┬───────┐
│ Processes │ Performance │ Networking │ Users │
├───────────┴─────────────┴────────────┘ └─────────────────────────────┐
│ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ User │ ID │ Status │ Client Name │ Session │ │
│ ├────────────────────┴──────┴────────────┴────────────────────┴──────────┤ │
│ │ root 1 Idle Console tty1 │ │
│ │ root 2 Idle Remote pts/0 │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ │
│ [ Log Off ] [ Send Message... ] │
└────────────────────────────────────────────────────────────────────────────┘
Processes: 13 │ CPU Usage: 0% │ Memory: 6 948 MB / 15 936 MB (44%)
Settings
Settings are saved on exit to ${XDG_CONFIG_HOME:-~/.config}/xptm/config (written
to a temporary file and renamed into place) and loaded on start. The file is
key = value lines; # starts a comment, and unknown keys are ignored. Options
given on the command line apply to that run only.
tab = processes # processes | performance | networking | users
update = normal # high (0.5 s) | normal (2 s) | low (4 s) | paused
theme = luna # luna | dark
glyphs = auto # auto | braille | blocks | ascii
columns = image,user,cpu,mem # see man xptm for all 19 column names
sort = cpu desc
show_all_users = true
show_kernel_threads = false
show_idle_process = true
confirm_kill = true
cpu_history = one # one | per_cpu
kernel_times = false
memory_graph = physical # physical | commit
net_history = total # any of total, sent, received
net_hide = lo,veth*,tap*,fwbr*,fwpr*,fwln*
show_all_adapters = false
thousands_sep = " "
Docker
docker compose build
docker compose run --rm xptm
The image holds a static musl build. The compose service shares the host's PID
and network namespaces, so it shows the host's processes and adapters. Inside a
container, memory figures come from /proc/meminfo, which reports the host's
memory rather than any container limit.
Performance
Measured on an 8-thread laptop with 530 processes, default columns:
| Measured | Budget | |
|---|---|---|
| Collection time per tick | 1.4 ms mean, 1.7 ms max (1.1 ms for 1000 processes) | ≤ 5 ms |
| CPU use at Normal (2 s) | 0.27 % | < 0.5 % |
| CPU use at High (0.5 s) | 0.75 % | < 2 % |
| Resident memory | 3.6 MB | < 8 MB |
| Stripped dynamic binary | 147 KB | < 150 KB |
| Syscalls per process per tick | 4 (openat, read, close, fstatat) |
≤ 4 |
Fixed /proc files stay open and are re-read with pread; the optional
per-process files (status, io, fd) are read only while a column needs them.
Development
src/collect/reads/procand/sysand has no curses dependency; neither dosrc/util/,src/actions.c,src/config.cand the graph rasterisersrc/ui/graph.c. The test runner links them without ncurses, so a curses call there fails the build.src/ui/is the interface: terminal setup, drawing helpers, list view, dialogs, menus and one file per tab.- All state lives in one
struct app(src/app.h) that is passed explicitly.
make test runs:
- unit tests for the parsers, formatting, graph rasteriser, ring buffers, hash
maps, process actions (against real
sleepchildren) and settings; tests/fixtures.sh, which runs--dumpagainst the fake/procand/systrees intests/fixtures/and compares the output with each case'sexpected.txt(UPDATE=1 sh tests/fixtures.shrewrites them after an intended change);tests/crosscheck.sh, which compares a live--dumpwithfree -m,nproc,/procand/proc/loadavg.
Set XPTM_DRY_RUN=1 to make Shut Down, Log Off and New Task print the command
they would run instead of running it.
Design decisions taken during development are recorded in DECISIONS.md, and
changes in CHANGELOG.md.
License
MIT; see LICENSE. Not affiliated with Microsoft.