How Linux System Monitor Gets Process Statistics

Im making a simple alternative to the default Linux system monitor.

I need to know how it raises process statistics, which is displayed on the Processes tab.

It probably shuts down / proc, but im unsure.

Also, where can I find the source code for the system monitor program?

Hi

Floor

Also, by looking at the gnome system monitor and programs such as ps and top, the code is hard to follow, and I cannot easily see how they actually get the process statistics. I believe the libproc library can be very useful, but I can not find any documentation on the Internet about what functions it contains. Can anyone or can point me in the right direction of the documentation, thanks ....

+3
source share
3 answers

Yes, he uses /proc. You can download sources for your distribution (assuming it's tag-based debian) with apt:

sudo apt-get source gnome-system-monitor

And you will have more examples in tools like top packaged in procps:

sudo apt-get source procps
+2
source

Utilities are combined into something called the procpssource of which is available here .

+2
source

/proc//stat /proc//statm. stat statm man- proc ( : http://linux.die.net/man/5/proc).

0

Source: https://habr.com/ru/post/1738032/


All Articles