Projects /Β rtop
git clone https://molodetz.nl/retoor/rtop.git
rtop
Author: retoor retoor@molodetz.nl
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
make
The build produces a single binary
rtop
with minimal dependencies.
Build Options
make clean # Remove build artifacts
make debug # Build with debug symbols
make install # Install to /usr/local/bin (requires root)
Usage
./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
./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.