Task Manager — monitor app

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/dev and 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 quits

Build and run — Rust

cargo run -p xframe-demo --example monitor_task_manager
# Esc or q quits; close the window to quit

Build and run — Python

PYTHONPATH=/root/monitor-wt/task-manager/lightgui_python python3 examples/monitor_task_manager/main.py
# close the window to quit

Source

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 a v/^ sort marker in the header.
  • The Python widget's _read_processes opened /proc/<pid>/status for every process on every scan (671 ms CPU for 400 processes). RSS now comes from stat field 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.
Linux Rocks Every Day
Source code: LightGUI (C) · LightGUI (Rust) · LightGUI (Python)