此脚本可以获取手机soc温度变化趋势,以及各个cooling devices的频率变化。使用此脚本的前提:安卓手机可以adb root进去。
rm ./thermal_simple.log #remove the old log file
#Temp
time0=TIME
name0=$(cat /sys/class/thermal/thermal_zone0/type) #soc thermal zone
#CPU Freq
name1=cpu0_cur_freq
name2=cpu0_max_freq
name3=cpu4_cur_freq
name4=cpu4_max_freq
#write name string at the first line in thermal_simple.log
echo $time0 $name0 $name1 $name2 $name3 $name4 >> ./thermal_simple.log
#per 100ms
while [ true ]
do
# time1=$(date "+%T")
currentTimeStamp=$(date +"%T.%3N") #time stamp, precise to miliseconds
value0=$(cat /sys/class/thermal/thermal_zone0/temp)
value1=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
value2=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)
value3=$(cat /sys/devices/system/cpu/cpu4/cpufreq/scaling_cur_freq)
value4=$(cat /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq)
echo $currentTimeStamp $value0 $value1 $value2 $value9 $value3 $value4 >> ./thermal_simple.log
#sleep 0.1
done
执行后,按Ctrl+C结束
执行后在当前路径下生成thermal_simple.log文件,文件内容(如下为示例,具体内容以实际情况为准):
TIME soc-thmzone cpu0_cur_freq cpu0_max_freq cpu4_cur_freq cpu4_max_freq
03:44:25.704 35248 768000 1200000 1600000 1600000
03:44:25.997 35248 768000 1200000 1600000 1600000
03:44:26.313 35248 768000 1200000 1600000 1600000
03:44:26.604 35248 768000 1200000 1600000 1600000
03:44:26.895 36161 768000 1200000 1600000 1600000
03:44:27.184 36161 768000 1200000 1600000 1600000
03:44:27.478 36161 768000 1200000 1600000 1600000
03:44:27.766 36161 768000 1200000 1600000 1600000
03:44:28.095 36161 768000 1200000 1600000 1600000
03:44:28.383 36161 768000 1200000 1600000 1600000
03:44:28.674 36161 768000 1200000 1600000 1600000
03:44:28.969 36161 768000 1200000 1600000 1600000
03:44:29.261 36161 768000 1200000 1600000 1600000
03:44:29.549 36161 768000 1200000 1600000 1600000
03:44:29.843 36161 768000 1200000 1600000 1600000
…