A simple system monitor for Linux, using gtkmm-4.0 and written in C++. This project was created as part of a school assignment to learn system-level programming in C++ and explore GUI development in gtk.
This program displays real-time usages statistics for the CPU, GPU, memory, hard drives and internet (upload/download).
The program gets system information from the Linux /proc pseudo-file-system and uses the Nvidia and/or AMD API to retrieve the GPU stats.
You can also use your favorite package manager to install the dependencies.
On Arch you would use pacman:
sudo pacman -S gcc gtk4 gtkmm4.0 cmake ninja
Clone the repository:
git clone https://github.com/Helland369/system_monitor.git
Cd to project:
cd system_monitor
Make the build script executable:
chmod +x build.sh
Run the script:
./build.sh
run the program
./build/system_monitor
You can get a binary here, but you need the gtk4 and gtkmm-4.0 dependencies.
This system monitor gathers system statistics by reading files from the /proc pseudo-filesystem and accessing the NVIDIA and/or AMD API for GPU stats. It uses gtkmm-4.0 to build a modern, native Linux GUI.
- While running the program, you can press
1through5to change the layout of the boxes.
-
CPU & Memory Usage:
Retrieved from
/proc/stat,/proc/meminfo, and other related files. -
Disk Usage:
Read from
/proc/diskstats. -
Network Usage:
Calculated Using
/proc/net/dev, tracking changes in RX/TX byte counts over time. -
GPU Usage:
Fetched via the Nvidia and/or AMD API. Depending on what GPU you have in your computer, the appropriate API (AMD or Nvidia or both) will be selected when building the program.
-
GUI:
Built with GTK4 widgets using the gtkmm C++ bindings, updated in real time using timers.
-
/src/main.cppMain entry point of the program. -
/src/SystemMonitorWindow.cppGTK related UI and rendering. -
/src/CpuUsage.cppLogic for gathering CPU usage info. -
src/FileSystem.cppLogic for gathering Disk usage info. -
src/MemInfo.cppLogic for gathering memory usage info. -
src/NetInfo.cppLogic for gathering Network info. -
src/GpuInfo.cppLogic for talking to the Nvidia and/or AMD API.
After building the project, you can run the binary from the build/ folder:
./system_monitor| Key to press | Action |
|---|---|
| 1 | Toggle on/off CPU usage |
| 2 | Toggle on/off Memory usage |
| 3 | Toggle on/off GPU usage |
| 4 | Toggle on/off Disk usage |
| 5 | Toggle on/off Network usage |
Tested on Arch Linux in I3 and X11. Tested on Arch Linux in SWAY/Wayland.
-
GPU monitoring only works with Nvidia GPUs via NVML and AMD GPUs via rocm_smi.h.
-
The program only supports Linux.
-
GTK themes maybe works.
-
UI may brake if you have multiple GPUs installed in you computer.
