# rtop **Author:** retoor A terminal-based system monitoring tool written in C that displays comprehensive system statistics in a dynamic, auto-refreshing interface. rtop is designed as a lightweight alternative to htop with no external dependencies beyond the standard C library. ## Features - Real-time system monitoring with configurable refresh interval - Per-core CPU utilization with temperature and frequency display - Memory and swap usage statistics - Process listing sorted by CPU or memory usage - Network interface statistics with RX/TX rates - Disk I/O statistics - Filesystem usage information - Color-coded output for utilization levels - Terminal resize handling - Keyboard controls (q to quit) ## Requirements - Linux operating system - GCC compiler (C99 compliant) - Make build system ## Building ```bash make ``` The build produces a single binary `rtop` with minimal dependencies. ### Build Options ```bash make clean # Remove build artifacts make debug # Build with debug symbols make install # Install to /usr/local/bin (requires root) ``` ## Usage ```bash ./rtop [OPTIONS] Options: -d, --delay SECS Update interval in seconds (default: 1.0) -s, --sort MODE Sort by: cpu (default), mem -h, --help Show help message -v, --version Show version ``` ### Examples ```bash ./rtop # Run with default settings ./rtop -d 2 # Update every 2 seconds ./rtop -s mem # Sort processes by memory usage ``` ## Display Sections - **Header**: Hostname, OS version, kernel, uptime, load averages - **CPU**: Per-core utilization, total usage, temperature, frequency - **Memory**: RAM and swap usage with buffer/cache information - **Processes**: Summary counts (running, sleeping, stopped, zombie) - **Network**: Interface statistics with IP addresses and transfer rates - **Disk I/O**: Read/write rates and IOPS per device - **Filesystems**: Mount points with usage percentages - **Process List**: Detailed per-process information ## Controls - `q` or `Q`: Quit the application - `Ctrl+C`: Terminate ## Technical Details ### Data Sources All system information is read from the Linux `/proc` and `/sys` filesystems: - `/proc/stat` - CPU statistics - `/proc/meminfo` - Memory information - `/proc/[pid]/stat` - Process information - `/proc/net/dev` - Network statistics - `/proc/diskstats` - Disk I/O statistics - `/sys/class/thermal/` - Temperature sensors ### Performance - Target CPU usage: <5% - Startup time: <100ms - Memory footprint: <10MB RSS - Binary size: ~1.2MB ## Project Structure ``` rtop/ ├── include/ │ ├── cpu.h │ ├── disk.h │ ├── display.h │ ├── filesystem.h │ ├── memory.h │ ├── network.h │ ├── process.h │ ├── system.h │ └── terminal.h ├── src/ │ ├── cpu.c │ ├── disk.c │ ├── display.c │ ├── filesystem.c │ ├── main.c │ ├── memory.c │ ├── network.c │ ├── process.c │ ├── system.c │ └── terminal.c ├── Makefile └── README.md ``` ## License This project is provided as-is for educational and personal use.