3 ## Displays the CPU load.
4 ## By Michal Nazareicz (mina86/AT/mina86.com)
5 ## Released to Public Domain
7 ## This is part of Tiny Applications Collection
8 ## -> http://tinyapps.sourceforge.net/
11 if [ "X$1" = X-h
] ||
[ "X$1" = "X--help" ]; then
13 usage: ${0##*/} [ -n | --nice ]
14 -n --nice includes nice value
19 if [ "X$1" = X-n
] ||
[ "X$1" = "X--nice" ]; then
36 total
=$
(( load
+ b
+ d
))
39 if [ -z "$ototal" ] ||
[ x
"$total" = x
"$ototal" ]; then
42 cpuload
=$
((10000 * (load-oload
) / (total-ototal
)))
45 printf " %3d.%02d%%\r" $
((cpuload
/ 100)) $
((cpuload
% 100))