SkillAgentSearch skills...

SysMon

Real-time Linux system monitor built in C++ using ncurses and /proc for CPU, memory, process, and network stats.

Install / Use

/learn @riteshdhurwey/SysMon

README

SysMon 🖥️

A lightweight, real-time Linux system monitor built in modern C++17 with zero external runtime dependencies (except ncurses).

Built for accurate metrics, stable process behavior, and clean terminal UX .

Platform C++17 TUI CI License


demo

What to notice in the demo:

  • Selection sticks to the same PID even while sorting changes
  • CPU usage updates smoothly using delta sampling (no spikes/jumps)
  • Clean window layout with stable rendering (minimal flicker)

⭐ If you find this useful, consider starring the repo


Why SysMon?

  • Stable process tracking — selection follows the same PID even during live sorting and updates
  • Accurate CPU measurement — delta-based calculation avoids misleading spikes
  • Correct disk usage — matches real system availability (df -h behavior)
  • Clean, predictable layout — structured ncurses UI for readability
  • Direct kernel data access — reads from /proc and statvfs, no shell utilities

Summary: SysMon is built for correctness, stability, and clarity, not just displaying stats.

Overview

SysMon is a terminal-based system monitor built from scratch in C++17. It reads directly from Linux kernel interfaces instead of relying on external tools like top, ps, or df.

Focus areas:

  • /proc parsing
  • CPU delta sampling
  • Memory correctness using MemAvailable
  • Disk accounting using statvfs
  • Real-time UI rendering with ncurses

Core Features

System Metrics

  • CPU usage (user, system, idle, iowait, IRQ)
  • Memory usage using accurate availability model
  • Disk usage aligned with df -h
  • System uptime
  • Network I/O per interface

Process Management

  • Full process list (PID, CPU%, memory, state)
  • Sorting (CPU / Memory / PID)
  • Scrollable navigation
  • Kill process support (K)
  • Kernel thread filtering
  • PID-stable selection across re-sorts

TUI

  • Window-based layout
  • Color-coded usage bars
  • Pause-on-scroll behavior
  • Help overlay (H)
  • Terminal resize handling

Performance

  • Refresh interval: 1s
  • CPU usage: ~3–5% (idle system)
  • Memory usage: ~5–6 MB
  • Consistent real-time updates with low overhead
  • Direct kernel reads (/proc, statvfs), no subprocess calls

How It Works (Key Concepts)

CPU Usage

cpu_usage% = (1 - idle_delta / total_delta) * 100

Memory

used = MemTotal - MemAvailable

Disk

used  = (f_blocks - f_bfree) * f_frsize
free  = f_bavail * f_frsize

Process CPU%

process_cpu% = (proc_delta / total_cpu_delta) * 100

Installation

Requirements

  • C++17 compiler
  • CMake
  • ncurses

Build

git clone https://github.com/riteshdhurwey/SysMon.git
cd SysMon
mkdir build && cd build
cmake ..
make

Install

sudo make install

Run

sysmon

Project Structure

sysmon/
├── include/
├── src/
└── tests/

Modular design with separate components for CPU, memory, process, network, and UI.


Roadmap

  • Detailed memory view
  • Disk I/O stats
  • Network graphs
  • Process filtering
  • Custom refresh intervals
  • Metrics export

Contributing

Contributions are welcome. See CONTRIBUTING.md.


Author

Ritesh Dhurwey LinkedIn · GitHub

View on GitHub
GitHub Stars16
CategoryOperations
Updated41m ago
Forks3

Languages

C++

Security Score

95/100

Audited on Apr 5, 2026

No findings