Task Manager — monitor app
Task Manager is a Windows-style Task Manager clone in one 1024x768 window — one of the ten Stage 2 monitor apps built from the new XFrame monitor widgets. It is tabbed: the Processes tab is the live process table, and the Performance tab is the live CPU / memory / disk / network overview. All data is live from /proc; no seeded demo data survives the first tick. Every visible UI element is a LightGUI XFrame widget; there is no hand-drawn UI.
What it shows
- Processes tab — pid, program, user, memory and CPU% for the live processes on this machine, refreshed every 2 seconds from
/proc. Click a column header to sort by it (click the current column again to reverse it). CPU% is per-core (100% = one core), computed from wall-time deltas between scans, with an in-cell bar; rows over 50% CPU are highlighted. The C++ app shows 40 rows, the Python app 38, the Rust app the top 12 by CPU. - Performance tab — CPU + Memory (60 s) history graph with legend (current / min / max / average), a per-core grid with a mini history per core, a Memory usage bar, a memory stack bar (Used / Cached / Buffers / Free), Disk / and Swap usage bars (C++ and Python), and a Network graph with live down/up rates from
/proc/net/devand accumulated totals.
Data is sampled every 500 ms; the window repaints every 2 s. A full repaint is hundreds of text measurements (one server round trip each in the C++ and Rust text helpers, and ~38 rows x 5 text calls in Python), so repainting every tick would never catch up and would burn ~40–55% of a core — at 2 s each repaint completes inside its interval and the graphs still advance live. Measured steady-state CPU on the 8-core dallas box: C++ ~11%, Rust ~12%, Python ~12%.
Widgets used
- XProcessList — the live process table.
- XHistoryGraph — 60 s CPU + memory history.
- XCoreGrid — per-core busy % with mini histories.
- XUsageBar — Memory, Disk / and Swap bars.
- XStackBar — memory breakdown (Used / Cached / Buffers / Free).
- XNetGraph — live network down/up with totals.
- TPageControl — the Processes / Performance tabs. The C++ widget draws its tabs and switches pages on click; the Rust widget draws no tab strip, so the Rust app uses two GtkButton tabs and routes clicks itself; the Python widget draws its tabs but tab clicks need app-level hit handling.
Build and run — C++
make # in examples/monitor/task-manager — produces ./task-manager
./task-manager # under Xvfb or a real X server; Esc quitsBuild and run — Rust
cargo run -p xframe-demo --example monitor_task_manager
# Esc or q quits; close the window to quitBuild and run — Python
PYTHONPATH=/root/monitor-wt/task-manager/lightgui_python python3 examples/monitor_task_manager/main.py
# close the window to quitSource
- C++: git.lightgui.com/thinkmelt/lightgui —
examples/monitor/task-manager/(main.cpp,Makefile,README.md), branchmonitor-apps/task-manager. - Rust: git.lightgui.com/thinkmelt/lightgui_rust —
crates/xframe-demo/examples/monitor_task_manager/(main.rs,README.md), branchmonitor-apps/task-manager. - Python: git.lightgui.com/thinkmelt/lightgui_python —
examples/monitor_task_manager/(main.py,README.md), branchmonitor-apps/task-manager.
Notes
- The app exposed two small widget bugs, fixed on the same branch: the Rust XProcessList PID column was 52 px, too narrow for 7-digit PIDs (the PID text touched the program name), and its sort indicator used Unicode triangles that have no glyph in the fixed core font — both fixed (64 px column, ASCII
v/^marker). The Python XProcessList columns were fixed offsets drawn for the 360 px demo widget, leaving a wide widget mostly empty — they are now width-relative fractions, like the C++ widget, with av/^sort marker in the header. - The Python widget's
_read_processesopened/proc/<pid>/statusfor every process on every scan (671 ms CPU for 400 processes). RSS now comes fromstatfield 24 and the uid lookup is cached per (pid, starttime), so a warm scan is ~75 ms — 9x faster. - Process names are the kernel's 15-character
comm(e.g.monitor_task_ma), not a widget truncation.