X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=master%2Froot%2Fbin%2Fcpumon_lite;fp=master%2Froot%2Fbin%2Fcpumon_lite;h=d9919a41332b8d4bce55abfef4969ee1caaffb1f;hb=4aba78da3d59d7f35ff10c799ab7d15b3ceba902;hp=0000000000000000000000000000000000000000;hpb=baa143ebf6783f4c5d813beaefd72befe4b95fbc;p=debian6500.git diff --git a/master/root/bin/cpumon_lite b/master/root/bin/cpumon_lite new file mode 100755 index 0000000..d9919a4 --- /dev/null +++ b/master/root/bin/cpumon_lite @@ -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