How Linux System Monitor obtains process statistics
I’m making a simple alternative to the default linux system monitor.
I would like to know how it boosts process statistics, which is displayed in the Processes tab.
It might run off/proc, but I’m not sure.
Also, where is the source code of the system monitoring program?
Also, after looking at the way GNOME system monitors and programs like ps and top, the code is hard to understand, and I can’t easily see how they actually get process statistics. I thought the libproc library might be very useful, but I couldn’t find any documentation on the web about what features were included. Does anyone have or be able to point me in the right direction of the docs, thanks…
Yes, it uses
/proc. You can use apt to download the source code for your distribution (assuming it’s tag-based debian):
sudo apt-get source gnome-system-monitor
You’ll have more examples in tools like top, packaged in procps:
sudo apt-get source procps