shell打印系统负载(过去一分钟)、帧率、温度

prefix=/srv/data/fitgatetrackmain/logs/
lines=10
drop_head=3
let lines= l i n e s + lines+ lines+drop_head

list=(pm2 list | grep fitgateTrack | grep -v stopped | awk -F' ' '{print $4}')
num=0

sleep 1

load=uptime | awk -F' ' '{print $10}'
i=0
while true
do
if [[ $i == $lines ]]; then
break
fi
let i++
#f=grep 'cpu MHz' /proc/cpuinfo | awk -F' ' '{print $4}'
#echo $f lscpu | grep 'CPU MHz' | awk -F' ' '{print $3}'
freq=$freq" "grep 'cpu MHz' /proc/cpuinfo | awk -F' ' '{print $4}' | awk '{sum+=$1} END {print sum/NR}'
load=$load" "uptime | awk -F' ' '{print $10}'
temp=$temp" "sensors | grep Package | sed -e 's/.*: *+\([0-9]*\)\..*/\1/g'

f=`echo $freq | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'`
l=`echo $load | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'`
t=`echo $temp | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'`
if (($i < $drop_head)); then
    freq=
    load=
    temp=	
sleep 1
    continue 
fi
echo `date`, $i, $f, $l, $t    
sleep 1

done
freq=echo $freq | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'
load=echo $load | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'
temp=echo $temp | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'

fps=
decodetime=
facetime=
for port in “ l i s t [ @ ] " ; d o l e t n u m + + l o g = {list[@]}"; do let num++ log= list[@]";doletnum++log=prefix$port”.log"
#tail -10 fitgateTrack-11104.log | awk -F’ |,’ '{print $4,$6,KaTeX parse error: Expected 'EOF', got '}' at position 2: 8}̲' fps=fsp" "tail -10 $log | awk -F' |,' '{print $4}' | awk '{sum+=$1} END {print sum/NR}'
decodetime=$decodetime" "tail -10 $log | awk -F' |,' '{print $6}' | awk '{sum+=$1} END {print sum/NR}'
facetime=$facetime" "tail -10 $log | awk -F' |,' '{print $8}' | awk '{sum+=$1} END {print sum/NR}'
done

fps=echo $fps | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'
decodetime=echo $decodetime | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'
facetime=echo $facetime | tr ' ' '\n' | awk '{sum+=$1} END {print sum/NR}'
echo $num $fps $decodetime $facetime $freq $load $temp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值