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
pgp00000.pgp
Description: PGP signature