Skip to content

dponnada8/ProcessManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ProcessManager

A real-time terminal process manager for Linux, written in C++17.

CPU[ |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ]  74.3%
  0[ ||||||||                                                      ]   8.9%  1[ ||||||||||||||                                                ]  15.3%
  2[ ||||||||||||                                                  ]  13.1%  3[ |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ]  74.3%
Mem[  12.6GB/  15.9GB (79.2%)                                            ]
Swp[   0.0MB/4096.0MB  (0.0%)                                            ]

     PID NAME                USER        CPU%  MEM(M) S RUNTIME   PRI  NI
    1482 yes                 donovan      74.3    0.4  R 2m18s      20   0
     338 snapd               root          3.1   49.5  S 1h04m     19  -1
    1023 systemd             donovan       0.4   12.6  S 1h04m     20   0
     ...

ProcessManager reads live data from /proc, renders a color-coded ncurses TUI, and supports process management (kill, pause, renice, affinity) and persistent CPU/memory limits.


Features

Category Details
Live metrics CPU% per core, aggregate CPU/memory/swap bars, load averages, uptime, disk I/O throughput
Process table PID, name, user, CPU%, RSS (MB), state, runtime, priority, nice, read/write I/O
Sorting Click any column header (mouse) or press s to cycle; S toggles direction; persists across sessions
Filtering / opens an inline search bar; filters by name, PID, or command line
Tree view V toggles parent→child tree with └─ indentation
Detail overlay Enter opens a full-screen panel with command line, threads, open file descriptors, memory map, and environment variables
Process actions Kill (SIGTERM/SIGKILL), pause (SIGSTOP), resume (SIGCONT), renice, CPU affinity — all with confirmation prompts
CPU throttling Set a CPU% cap per process name (l); ProcessManager enforces it with a SIGSTOP/SIGCONT duty cycle; processes are always resumed on exit
Memory warnings Set a memory threshold per process name (m); the MEM column turns red when exceeded
Themes Dark (default) and light color schemes; T toggles live
Config JSON config at ~/.processmanager/config.json; sort order, theme, refresh rate, and all limits persist

Requirements

  • Linux (reads /proc)
  • GCC 10+ or Clang 12+ (C++17)
  • CMake 3.16+
  • libncursesw development headers
# Ubuntu / Debian
sudo apt install build-essential cmake libncursesw5-dev

# Fedora / RHEL
sudo dnf install gcc-c++ cmake ncurses-devel

Build

git clone https://github.com/yourname/processmanager.git
cd processmanager

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)

# Run directly
./build/processmanager

# Or install to /usr/local/bin
sudo cmake --install build

Usage

processmanager [OPTIONS]

  -h, --help             Show help and exit
  -v, --version          Print version and exit
  --sort <column>        Initial sort: cpu mem pid name user runtime pri read write
  --refresh <seconds>    Refresh interval (default: 1.0)
  --theme <name>         Color theme: dark  light

Keybindings

Key Action
q Quit
/ Move selection
PgUp / PgDn Page up / down
Enter Open process detail overlay
q (in detail) Close detail overlay
j / ↑↓ (in detail) Scroll detail content
/ Open search / filter bar
Esc Clear search
s Cycle sort column
S Toggle sort direction (ascending / descending)
V Toggle tree view
T Toggle dark / light theme
k Send SIGTERM (graceful kill) — confirmation required
K Send SIGKILL (force kill) — confirmation required
p Send SIGSTOP (pause) — confirmation required
r Send SIGCONT (resume)
n Renice — prompts for nice value (−20 to 19)
a Set CPU affinity — prompts for CPU list (0,1 or 0-3 or 0xff)
l Set CPU% throttle limit for selected process name (0 = off)
m Set memory warning threshold in MB for selected process name (0 = off)

Config file

~/.processmanager/config.json is created on first run with defaults and updated on exit.

{
    "refresh_rate_sec": 1.0,
    "theme": "dark",
    "sort_column": "cpu",
    "sort_descending": true,
    "limits": {
        "firefox": {
            "cpu_limit_percent": 50.0,
            "mem_warn_mb": 2048.0
        }
    }
}

---

## Architecture

src/ ├── proc/ │ ├── process.h — Process struct (all fields for all phases) │ ├── proc_reader.cpp — /proc iterator; CPU% diff; new-process highlight │ ├── io_reader.cpp — /proc/pid/io disk throughput │ ├── system_stats.cpp — /proc/stat aggregate + per-core CPU; /proc/meminfo │ ├── detail_reader.cpp — /proc/pid/{fd,maps,task,environ} │ ├── process_manager.cpp — send_signal / renice / sched_setaffinity │ └── throttler.cpp — SIGSTOP/SIGCONT duty-cycle CPU limiter ├── config/ │ └── config.cpp — JSON load/save via nlohmann/json └── ui/ ├── tui.cpp — Main loop; input dispatch; data orchestration ├── header.cpp — CPU/mem/swap bars ├── process_list.cpp — Sortable, filterable, tree-capable process table ├── detail_view.cpp — Full-screen process detail overlay ├── action_bar.cpp — Confirm / input / feedback bottom bar ├── search_bar.h — Inline filter prompt (header-only) └── theme.cpp — Dark / light ncurses color pairs


Dependencies: [`nlohmann/json`](https://github.com/nlohmann/json) (header-only, fetched by CMake), [`ncursesw`](https://invisible-island.net/ncurses/) (system package). No other runtime dependencies.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors