user@devops:~$ cat README.md
CPU Stat
# Description
CPU Stat is a C++23 CLI tool that reads and breaks down per-core CPU utilization from /proc/stat — the 8 counters per core (user, nice, system, idle, iowait, irq, softirq, steal) plus the total aggregate. It computes usage percentages as a delta between two samples (jiffy difference), presenting a table with all available system cores. High values are color-coded (red >= 50%, yellow >= 25%, green < 25%) for quick identification of loaded cores. Includes system context: load average with running/total processes and last PID, and formatted uptime (dd hh:mm:ss). Watch mode (--watch N) with periodic refresh and clean Ctrl+C exit, valid JSON output for scripting (--json), no-color for pipes (--no-color) and a self-test with 15 cases (--selftest) that verifies the parser against real /proc/stat lines. Strict parsing using std::from_chars with no exceptions — malformed lines are rejected. Zero dependencies: direct compilation with g++ -std=c++23, standard library only.
# Key features
$ Kernel CPU counters: /proc/stat with 8 metrics per core (user, nice, system, idle, iowait, irq, softirq, steal)
$ Percentages computed as jiffy delta between samples with 1-decimal precision
$ Color coding: red >= 50%, yellow >= 25%, green < 25% for quick load detection
$ System context: load average, running/total processes, last PID, formatted uptime
$ Watch mode with periodic refresh (--watch N) and clean Ctrl+C exit
$ Valid JSON output for scripting (--json)
$ Self-test with 15 cases including real /proc/stat reading (--selftest)
$ Zero dependencies: direct compilation with g++ (C++23, GCC 14, standard library only)
# Gallery
# Technologies used