|Greg Briggs' Technical Articles||Article Index|
This C program will display a CPU usage line, similar to top except that it just prints a single line for the system and then exits. This is particularly useful for consumation by scripts.
By default it will average over 3 seconds, but you can select any number of seconds.
Cpu(s): 0.3% us, 0.0% sy, 0.0% ni, 99.7% id, 0.0% wa, 0.0% hi, 0.0% si
Please see README and LICENSE files in the download. This application is available under the GPL version 2.
To uncompress, use any Linux facility. On the command line, "tar -xzvf cpuutil-0.1.tgz".
Similar commands: top, mpstat, sar
I can be contacted by emailing "greg (at) uofr dot net".
Read more computer-related articles
© 2002-2009 Greg Briggs except where attributed otherwise