+_print_cpu() {
+ typeset -R4 _1=${1} _2=${2} _3=${3} _4=${4} _5=${5}
+ echo -n "CPU:${_1}% User${_2}% Nice${_3}% Sys${_4}% Int${_5}% Idle "
+}
+
+print_cpu() {
+ OUT=""
+ # iostat prints each column justified to 3 chars, so if one counter
+ # is 100, it jams up agains the preceeding one. sort this out.
+ while [ "${1}x" != "x" ]; do
+ if [ ${1} -gt 99 ]; then
+ OUT="$OUT ${1%100} 100"
+ else
+ OUT="$OUT ${1}"
+ fi
+ shift;
+ done
+ _print_cpu $OUT
+}
+