[LCP] c library for *nix system stats

David Nugent davidn at datalinktech.com.au
Wed Feb 4 15:05:01 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/02/2009, at 11:26 PM, Christopher Howard wrote:

> Is there a convenient c library or two for pulling system statistics  
> like
> RAM usage, Disk usage, CPU load, etc? I've heard that this info is  
> all in
> the proc files, but my project is a fairly small one, and I'd rather  
> not
> have to find and parse all of them myself.


Bear in mind that any code that deals with /proc or any other kernel  
filesystem is going to be limited to Linux systems. That may or may  
not be an issue. The rusage interface is somewhat more portable will  
provide at least some of what you're looking for.

Beyond rusage there isn't really an official portable interface for  
this type of data, but I would suggest that code for a portable SMNP  
agent would provide a good start as these agents aggregate the type of  
data you're looking for in order to make it available via the network  
for remote queries. Some will have libraries that hide the non- 
portability of the implementation. Or maybe SNMP is what you're  
looking for since it is already done and available?


Regards,

- --
David Nugent (davidn at datalinktech.com.au)
Software Engineer
datalink technologies pty ltd
Mobile GPS/GPRS business process solutions
http://www.datalinktech.com.au/



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkmJE+0ACgkQgyBtWyGDJqUBCwCfStynP8aCtzVkpieCq5OcB/TJ
mRsAnRU8/GgM7EWoUzJAGwzvgFTx3Whq
=lvS+
-----END PGP SIGNATURE-----



More information about the linuxCprogramming mailing list