最近用全志的方案做CPU频率切频稳定性测试,就是不停地切换频率,测试CPU跑在每个频率上时候的稳定性,测试的设计思路如下:(以R331为例)
1.先把cpu频率调到1200M,跑memtester 10M 1000, 300秒后kill掉
2.将频率调到1104M,跑30秒memtester,然后再往下调一档,继续跑30秒memtester,依此类推 3.每档都跑30秒,直到最低档60M时跑300秒 4.CPU频率从60M开始,一档档往上升,每档跑30秒memtester,逆着降频时候的流程跑。 5.重复1.
cpu的频率点:1.2G 1.104G 1.008G 912M 816M 720M 648M 600M 504M 480M 408M 312M 240M 120M 60M
调频策略选的是userspace,就是用户想跑多少就跑多少:
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
全志的频率一般是写死几个等级,在只能在几个等级之间切换,比如R331就是上面的:
1.2G 1.104G 1.008G 912M 816M 720M 648M 600M 504M 480M 408M 312M 240M 120M 60M
这些参数是经过全志芯片测试的,为什么这些数值不知道,好像和倍频有关。
附测试脚本(一项项暴力写死循环):
代码语言:javascript复制# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
test_count=0
test_count_total=99999
sleep_time_long=300
sleep_time_short=30
#set CPU modle to userspace,set MAX frep to 1200M,set MIN frep to 60M
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 60000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
while [ ${test_count} -le ${test_count_total} ]
do
#test times
let test_count =1
echo "test count: "${test_count}
#1.set CPU freq 1200M
echo 1200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_long}
killall memtester
#2.set CPU freq 1104M
echo 1104000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#3.set CPU freq 1008M
echo 1008000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#4.set CPU freq 912M
echo 912000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#5.set CPU freq 816M
echo 816000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#6.set CPU freq 720M
echo 720000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#7.set CPU freq 648M
echo 648000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#8.set CPU freq 600M
echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#9.set CPU freq 504M
echo 504000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#10.set CPU freq 480
echo 480000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#11.set CPU freq 408M
echo 408000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#12.set CPU freq 312M
echo 312000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#13.set CPU freq 240M
echo 240000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#14.set CPU freq 120M
echo 120000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#15.set CPU freq 60M
echo 60000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_long}
killall memtester
#16.set CPU freq 120M
echo 120000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#17.set CPU freq 240M
echo 240000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#18.set CPU freq 312M
echo 312000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#19.set CPU freq 408M
echo 408000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#20.set CPU freq 480M
echo 480000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#21.set CPU freq 504M
echo 504000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#22.set CPU freq 600M
echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#23.set CPU freq 648M
echo 648000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#24.set CPU freq 720M
echo 720000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#25.set CPU freq 816M
echo 816000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#26.set CPU freq 912M
echo 912000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#27.set CPU freq 1008M
echo 1008000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
#28.set CPU freq 1104M
echo 1104000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo -e "nSET CPU FREQ :"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
memtester 10M 1000 &
sleep ${sleep_time_short}
killall memtester
done
echo "test_count: " ${test_count}
exit 0
*20181008修改,修正了脚本中切换的频率,把所有的支持的频率都加上了。