X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=master%2Froot%2Fbin%2Fcpumon_light;fp=master%2Froot%2Fbin%2Fcpumon_light;h=e4509524d35fe195af0ecdf410e24349a274e48a;hb=8c9776d240528a53077da065551307a8aa41d443;hp=0000000000000000000000000000000000000000;hpb=74ebc8afd300b2ea65f62f216724105259fe8ee0;p=debian6500.git diff --git a/master/root/bin/cpumon_light b/master/root/bin/cpumon_light new file mode 100755 index 0000000..e450952 --- /dev/null +++ b/master/root/bin/cpumon_light @@ -0,0 +1,20 @@ +#!/bin/sh + +INSTALL_DIR=$(dirname $0) + +$INSTALL_DIR/monitor_proc -s /proc/stat +while true; do + sleep 1 + $INSTALL_DIR/monitor_proc /proc/stat | \ + awk ' +BEGIN { printf "cpu:" } +/cpu[0-9]/ { + idle=$5 + sum=0; for (i=2;i<=NF;i++) sum+=$(i) + load=(sum-idle)*100/sum + tot+=load + if (!not_first) not_first=1; else printf " +" + printf " % 5.1f%%", load +} +END { printf " = % 6.1f%%\n", tot }' +done