You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3-level memory parser with fallbacks (smaps_rollup → smaps → status)
meminfo.c
Parses /proc/meminfo — system RAM/swap totals
pid_io.c
Parses /proc/[pid]/io — I/O bytes (requires root)
📂 src/ui/ — The Display
ncurses-based terminal interface.
File
Purpose
display.c
Main renderer — list view, inspect view, input handling, colors
view.c
ViewState — Freezes UI state during render for stable selection
gauge.c
Unicode block gauges [████████░░░░]
sparkline.c
Multi-row vertical bar graphs for memory trends
box.c
Box-drawing utilities with Unicode characters
Key Concepts in UI
Auto-Baseline Tracking:
// display.c maintains a hashmap of first-seen RSS per PIDstaticbaseline_entry_tbaseline_hash[BASELINE_HASH_SIZE];
// Delta shows change since first observationdoubledelta=current_rss-get_first_rss(pid, current_rss, start_time);
ViewState Pattern:
// Freeze visible rows at render timeview_begin_frame(selected_idx, scroll, visible, group_mode);
// ... populate rows ...view_end_frame();
// Later, when Enter is pressed:pid_tpid=view_get_selected_pid(); // Returns frozen PID
📂 src/util/ — The Foundation
Generic infrastructure code.
File
Purpose
arena.c
Linear allocator — Zero-malloc in hot path, O(1) alloc/reset