This project aims at building a Linux system monitor inspired by htop. It is meant to be hands-on training for the Object Oriented Programming Course of the Udacity C++ Nanodegree Program.
The ncurses library is required to facilitate text-based graphical output in the terminal to display the output of the monitor.
Install ncurses on your own Linux environment:
sudo apt install libncurses5-dev libncursesw5-dev
-
git clone https://github.com/Robotawi/CppND-Linux-system-monitor.git
-
cd CppND-System-Monitor mkdir build cd build cmake .. make
From inside the build folder, the executable of the system monitor can be run as follows
./monitor
The main functionality of the project depends on parsing the linux file system files to collect data about the operating system, the processor, and the running processes.
The information about the different system components are collected as follows:
- Operating system:
/etc/os-release
- Kernel:
/proc/version
- Memory utilization:
/proc/meminfo
- Total processes:
/proc/meminfo
- System up time:
/proc/uptime
- Processor data:
/proc/stat
- Username
/etc/passwd
- Process up time
/proc/[pid]/stat
- Process command
/proc/[pid]/cmdline
- Process memory info
/proc/[pid]/status
- Process CPU info
/proc/[PID]/stat
- How to calculate the memory utilization?
- How to calculate CPU utilization?
- man page for
proc
. - Process identifier (PID) number.
- User identifier (UID).
- How to calculate process CPU utilization?
If you are interested in the presented work/ideas or if you have any questions, you are welcome to connect with me on LinkedIn. We can discuss about this project and other interesting projects.