近日负责调整系统性能,对系统做了周身裁剪,包含APP,内核无关配置项,以及无关的so库等。。。
其次,硬件方面,我们使用的是MTK6797硬件平台,进入系统后,发现系统一般只开了一半的核数,而且并非高频运行,因此写了一个脚本来控制cpu的运行状态:
如下:
#!/system/bin/sh
# 0~3 max:1391000
# 4~7 max:1846000
# 8~9 max:2314000
#/sys/devices/system/cpu/cpu6/cpufreq/scaling_available_frequencies
cpu_base=/sys/devices/system/cpu
thermal_base=/sys/class/thermal
high_conf=/system/etc/.tp/.ht120.mtc
def_conf=/system/etc/.tp/thermal.conf
def_conf_bak=$def_conf.syn
function help_list() {
echo -e "\r"
echo "#####################################"
echo "# help (display help list)"
echo "# max (make all cpu fullspeed)"
echo "# min (power save mode)"
echo "# normal (make cpu at normal mode)"
echo "# state (display cpu info)"
echo "# thermal (higher thermal config)"
echo "#####################################"
echo -e "\r"
}
if [ $# -ne "1" ]; then
help_list
exit 1
fi
if [ $1 = "help" ]; then
help_list;
exit 0
elif [ $1 = "thermal" ]; then
if [ -f $def_conf_bak ]; then
echo "Already high temp mode"
exit 0
fi
echo "================cpu set=================="
mount -o remount,rw /system
cp $def_conf $def_conf_bak
cp $high_conf $def_conf
mount -o remount,ro /system
elif [ $1 = "max" ]; then
echo "================cpu set=================="
for i in `seq 10`
do
((i=$i-1))
# ((j=$i+4))
# if [ $i -eq "4" ]; then
# echo "0" > $cpu_base/cpu$i/online
# else
echo "1" > $cpu_base/cpu$i/online
# sleep 0.1
# fi
MAX_FREQ[$i]=`cat $cpu_base/cpu$i/cpufreq/scaling_available_frequencies | busybox awk -F ' ' '{print $1}'`
# echo ${MAX_FREQ[$i]}
echo "performance" > $cpu_base/cpu$i/cpufreq/scaling_governor
echo "$MAX_FREQ[$i]" > $cpu_base/cpu$i/cpufreq/scaling_setspeed
if [ $i -le "5" ]; then
echo "0" > $cpu_base/cpu$i/online
fi
cpu4_state=`cat $cpu_base/cpu4/online`
if [ $cpu4_state == "1" ]; then
echo "0" > $cpu_base/cpu6/online
fi
done
elif [ $1 = "min" ]; then
echo "================cpu set=================="
for i in `seq 2`
do
((i=$i-1))
echo "1" > $cpu_base/cpu$i/online
# sleep 0.01
echo "powersave" > $cpu_base/cpu$i/cpufreq/scaling_governor
done
for j in `seq 8`
do
((j=$j+1))
echo "0" > $cpu_base/cpu$j/online
# sleep 0.01
done
elif [ $1 = "normal" ]; then
echo "================cpu set=================="
for i in `seq 5`
do
((i=$i-1))
echo "1" > $cpu_base/cpu$i/online
echo "interactive" > $cpu_base/cpu$i/cpufreq/scaling_governor
((j=$i+5))
echo "0" > $cpu_base/cpu$j/online
done
elif [ $1 = "state" ]; then
echo "###############################################"
for i in `seq 10`
do
((i=$i-1))
online=`cat $cpu_base/cpu$i/online`
if [ $online = "1" ];then
echo "cpu $i ON temp:`cat $thermal_base/thermal_zone$i/temp` freq:`cat $cpu_base/cpu$i/cpufreq/scaling_cur_freq` mode:`cat $cpu_base/cpu$i/cpufreq/scaling_governor`"
else
echo "cpu $i OFF"
fi
#echo -e "\r"
done
echo "###############################################"
exit 0
else
help_list
exit 1
fi
echo "================set finish================"
exit 0
目前max也就是开了四个核,开满了风扇效率不沾的话片子会重启。6797是4个1.4GHz+4个2.0GHz+2个2.4GHz。