A real-time system monitoring application built with Dear ImGui and SDL2, providing comprehensive system information visualization including CPU, memory, network, thermal, and fan monitoring.
# Clone and build
git clone https://github.com/kh3rld/sysmon.git
cd sysmon
make
# Run the system monitor
./monitor
# Or try test mode for quick system info
./monitor --testSysMon is a lightweight, high-performance system monitoring tool designed for Linux systems. It provides real-time visualization of system resources with a modern, responsive GUI built using Dear ImGui. The application features intelligent caching mechanisms and optimized process scanning to ensure minimal resource usage while delivering comprehensive system insights.
- Real-time monitoring of CPU, memory, network, and system processes
- Modern GUI with dark theme optimized for system monitoring
- Performance optimized with intelligent caching and efficient I/O
- Command-line interface for quick system info without GUI
- Cross-platform build support with comprehensive CI/CD pipeline
For detailed information about features, installation, and usage, see our Release Notes.
- OS Detection: Automatic detection of operating system (Linux, Windows, macOS, etc.)
- Host Information: Display hostname and current username
- CPU Model: Real-time CPU brand string detection
- Process Statistics: Live count of running, sleeping, zombie, and stopped processes
- CPU Usage Graph: Real-time CPU utilization with configurable update rate (1-30 FPS)
- Thermal Monitoring: Temperature tracking with color-coded status indicators
- Fan Speed Monitoring: RPM tracking with PWM level display
- Graph Controls: Pause/resume, FPS adjustment, and Y-axis scaling
- Memory Usage: RAM, SWAP, and disk usage with visual progress bars
- Process Table: Sortable process list with filtering capabilities
- Process Details: PID, name, state, CPU%, and memory% for each process
- Multi-selection: Ctrl+Click to select multiple processes
- Interface Detection: Automatic discovery of network interfaces and IP addresses
- Statistics Tables: Detailed RX/TX statistics (bytes, packets, errors, drops)
- Usage Visualization: Progress bars showing network usage relative to 2GB scale
- Real-time Monitoring: Live network activity tracking
sysmon/
├── main.cpp # Application entry point and window management
├── header.h # Global declarations and data structures
├── system.cpp # System information and performance monitoring
├── mem.cpp # Memory management and process handling
├── network.cpp # Network interface monitoring
├── Makefile # Build configuration
└── imgui/ # Dear ImGui library (external dependency)
struct SystemInfo {
string os_name;
string hostname;
string username;
string cpu_model;
int total_processes;
int running_processes;
int sleeping_processes;
int zombie_processes;
int stopped_processes;
};struct CPUStats {
long long int user, nice, system, idle;
long long int iowait, irq, softirq, steal;
long long int guest, guestNice;
};
struct ThermalInfo {
float temperature;
bool available;
};
struct FanInfo {
int speed; // RPM
int level; // PWM level (0-255)
bool active;
bool available;
};struct MemoryInfo {
unsigned long total_ram, available_ram, used_ram;
unsigned long total_swap, used_swap;
unsigned long total_disk, used_disk;
};
struct Proc {
int pid;
string name;
char state;
long long int vsize, rss, utime, stime;
};struct Networks {
vector<IP4> ip4s;
};
struct RX {
int bytes, packets, errs, drop;
int fifo, frame, compressed, multicast;
};
struct TX {
int bytes, packets, errs, drop;
int fifo, colls, carrier, compressed;
};# Install SDL2 development libraries
sudo apt-get install libsdl2-dev
# For Ubuntu/Debian
sudo apt-get install build-essential# Install SDL2 via Homebrew
brew install sdl2# Install SDL2 via pacman
pacman -S mingw-w64-i686-SDL2-
Clone and navigate to project directory
cd sysmon -
Build the application
make
-
Run the application
./monitor
-
Clean build artifacts
make clean
The application displays three main windows:
-
System Window (Top-left)
- System information display
- Performance monitoring tabs (CPU, Fan, Thermal)
- Real-time graphs with configurable controls
-
Memory & Processes Window (Top-right)
- Memory usage bars (RAM, SWAP, Disk)
- Process table with sorting and filtering
- Multi-process selection capabilities
-
Network Window (Bottom)
- Network interface overview
- Statistics and usage visualization tabs
- Real-time network monitoring
- Pause/Resume: Stop or resume data collection
- FPS Slider: Adjust update rate (1-30 FPS)
- Y-Scale: Modify graph vertical scale
- Filter Input: Type to filter processes by name
- Column Sorting: Click column headers to sort
- Multi-selection: Ctrl+Click to select multiple processes
- Clear Selection: Button to deselect all processes
- Tab Navigation: Switch between statistics and visualization
- Real-time View: Combined RX/TX activity display
Returns comprehensive system information including OS, hostname, username, CPU model, and process counts.
Reads current CPU statistics from /proc/stat.
Calculates CPU usage percentage between two measurements.
Parses /proc/meminfo and filesystem statistics to return memory usage information.
Scans /proc directory to collect information about all running processes.
Retrieves detailed information about a specific process from /proc/[pid]/stat.
Calculates memory usage percentage for a process relative to total system memory.
Discovers network interfaces and their IPv4 addresses using getifaddrs().
Parses /proc/net/dev to collect network statistics for all interfaces.
Formats byte counts into human-readable strings (B, KB, MB, GB).
Searches for thermal sensors in /sys/class/thermal/ and /sys/class/hwmon/.
Discovers fan sensors and retrieves speed, PWM level, and status information.
// CPU Graph
extern vector<float> cpu_history;
extern atomic<float> current_cpu_usage;
extern bool graph_paused;
extern float graph_fps;
extern float graph_scale;
// Thermal Graph
extern vector<float> thermal_history;
extern atomic<float> current_temperature;
extern atomic<bool> thermal_available;
// Fan Graph
extern vector<int> fan_speed_history;
extern atomic<int> current_fan_speed;
extern atomic<bool> fan_available;void updateCPUHistory(); // Updates CPU usage data
void updateThermalHistory(); // Updates temperature data
void updateFanHistory(); // Updates fan speed datavoid renderCPUGraph(); // Renders CPU usage graph
void renderThermalGraph(); // Renders temperature graph
void renderFanGraph(); // Renders fan speed graph- All shared data structures use
std::atomicfor thread-safe access - Critical sections are protected with
std::mutex - Graph data updates are synchronized to prevent race conditions
- Process scanning is limited to 3-second intervals to reduce system load
- Network data updates occur every 2 seconds
- Graph history is limited to 100 data points to prevent memory bloat
- CPU usage calculations use efficient
/proc/statparsing
- Primary: Linux (uses
/procfilesystem extensively) - Secondary: Windows, macOS (limited functionality)
- Dependencies: SDL2, OpenGL 3.0+, Dear ImGui
/proc/stat- CPU and process statistics/proc/meminfo- Memory information/proc/net/dev- Network interface statistics/proc/[pid]/stat- Individual process information/sys/class/thermal/- Thermal sensor data/sys/class/hwmon/- Hardware monitoring data
- Use consistent naming conventions (snake_case for functions, camelCase for variables)
- Include comprehensive error handling for file operations
- Add comments for complex algorithms and data structures
- Follow the existing modular architecture
- Define data structures in
header.h - Implement functionality in appropriate
.cppfile - Add rendering functions for UI components
- Update main window functions to include new features
- Test on multiple Linux distributions
This project is open source. Please refer to the individual component licenses for Dear ImGui and SDL2.
- SDL2 not found: Install development libraries (
libsdl2-dev) - OpenGL errors: Ensure OpenGL 3.0+ support
- Compilation errors: Check C++11 compatibility
- No thermal data: System may not have accessible thermal sensors
- No fan data: Fan sensors may not be available or accessible
- Permission errors: Some
/procfiles may require elevated privileges
- High CPU usage: Reduce graph FPS or pause monitoring
- Memory leaks: Ensure proper cleanup in destructors
- UI lag: Check for excessive process scanning or network polling
- Enable debug output by adding
-DDEBUGto CXXFLAGS - Check console output for error messages
- Verify file permissions for
/procand/sysaccess