views:

171

answers:

3

Hi all,

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

Im looking to know how it lifts the process stats, which is displays in the Processes tab.

It probably runs off /proc, but im unsure.

Also, where could i find the source code for the system monitor program?

Regards

Paul

Also, having looked at how 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 process stats. Im thinking that the libproc library could be very useful, but i cannot find any documentation online about what functions are contained within it. Would anybody have or be able to point me in the right direction of the documentation, thanks....

+2  A: 

The utilities are bundled in something called procps, the source of which is available here.

Xr
+2  A: 

Yes, it uses /proc. You can download the sources for your distribution (assuming that it's debian based by the tags) 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
Jaime Soriano
A: 

Usually process information is fetched from /proc//stat and /proc//statm. The different fields in stat and statm are described in the man-page for proc (which also are to be found here: http://linux.die.net/man/5/proc).

khn