scripts: Add cpuload script

This commit is contained in:
Markus Koch 2018-01-14 21:13:35 +01:00
parent 3c25409dfa
commit 91c3d95f04

10
scripts/cpuload.sh Executable file
View File

@ -0,0 +1,10 @@
source common.sh
echo -e "xx" > $hcs
while [ 1 ]; do
cpu=`cat <(grep 'cpu ' /proc/stat) <(sleep 0.1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}' | sed "s/\..*//g"`
prg=$(((($cpu*1000) / 100) * 60 / 1000))
printf "x%02d %02d\n" $prg $prg > $hcs
#sleep 0.1
done