# rtop **Author:** retoor A terminal-based system monitoring tool written in C that displays comprehensive system statistics in a tabbed, auto-refreshing interface. rtop is designed as a lightweight alternative to htop with no external dependencies beyond the standard C library. ## Features - Tabbed interface with 5 dedicated views (CPU, Memory, Network, Disk, Process) - Real-time system monitoring with configurable refresh interval - Auto-rotate tabs at configurable interval - Pause mode for copy/paste operations - Per-core CPU utilization with temperature and frequency display - Memory and swap usage statistics with task summary - Process listing sorted by CPU or memory usage - Network interface statistics with RX/TX rates and IP addresses - Disk I/O statistics with IOPS - Filesystem usage information - Color-coded progress bars for utilization levels - Terminal resize handling ## 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) -r, --rotate SECS Auto-rotate tabs every SECS seconds (0=off, default: 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 -r 5 # Auto-rotate tabs every 5 seconds ./rtop -s mem # Sort processes by memory usage ./rtop -d 0.5 -r 3 # Fast refresh with 3-second tab rotation ``` ## Tabs | Tab | Content | |-----|---------| | CPU | Per-core utilization bars, temperature, frequency, total usage | | Memory | RAM/Swap usage, buffers/cache, task summary (running, sleeping, stopped, zombie) | | Network | Interface list with IP addresses, RX/TX rates, total bytes transferred | | Disk | Per-device I/O rates, IOPS, filesystem mount points with usage | | Process | Detailed process list with PID, user, CPU%, MEM%, command | ## Controls | Key | Action | |-----|--------| | Left/Right arrows | Switch between tabs | | 1-5 | Jump directly to tab | | ESC | Pause refresh (for copy/paste) | | q / Q | Quit the application | | Ctrl+C | Terminate | ## Technical Details ### Data Sources All system information is read from the Linux `/proc` and `/sys` filesystems: | Source | Information | |--------|-------------| | `/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 | | `/sys/devices/system/cpu/` | CPU frequency | ### Performance - Target CPU usage: <5% - Startup time: <100ms - Memory footprint: <10MB RSS ## 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.