vfdboard/scripts/cpuload.sh

11 lines
316 B
Bash
Executable File

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