Pointers about CPU load measuring

Brooks Davis brooks at one-eyed-alien.net
Fri Apr 2 10:46:17 PST 2004


On Fri, Apr 02, 2004 at 03:38:55PM +0200, Jose Marcio Martins da Cruz wrote:
> 
> Someone can send some pointers on how to measure global CPU load under 
> FreeBSD from a C program ? I'm looking for values for idle/kernel/user, 
> in a similar way as does top. Is there any pointer or doc ?. I'd like to 
> avoir browsing top code.

The top code is rather gross.  You might take a look at the Ganglia
source code.  It products metrics like that in fairly focused functions
so it's more readable then top.

The file you're intrested in is here:

http://cvs.sourceforge.net/viewcvs.py/ganglia/monitor-core/gmond/machines/freebsd.c?rev=1.7&view=auto

If you want to play with the whole thing, the
sysutils/ganglia-monitor-core port may be of use.

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20040402/20a4eb17/attachment.bin


More information about the freebsd-hackers mailing list