android cpu使用率脚本

计算android cpu使用率脚本

计算CPU 使用率shell脚本
采集到的cpu使用率在cpu.txt中,可以通过UNIT_TIME设置周期,即每隔多长时间采样一次

#!/bin/sh

#top -n 1|tail -n +5 |./busybox-armv7l awk '{sum+= $5} END {print sum}'
rm top.txt
rm cpu.txt

SECS=3600
UNIT_TIME=3

#for((;;))
#for((i=0;i top.txt
	echo $cpuusage >>cpu.txt
	echo "cpu usage $cpuusage"
	sleep $UNIT_TIME
done

你可能感兴趣的:(linux)