本文共 4722 字,大约阅读时间需要 15 分钟。
Z91:/sys/devices/system/cpu # ls -allls -alltotal 0drwxr-xr-x 13 root root 0 2018-01-09 11:17 .drwxr-xr-x 6 root root 0 2018-01-09 11:17 ..drwxr-xr-x 5 root root 0 2018-01-09 11:17 cpu0 [查看CPU 核数,频率,策略,频率档位]drwxr-xr-x 5 root root 0 2018-01-10 14:23 cpu1drwxr-xr-x 5 root root 0 2018-01-10 14:23 cpu2drwxr-xr-x 5 root root 0 2018-01-10 14:23 cpu3drwxr-xr-x 3 root root 0 2018-01-09 11:17 cpufreqdrwxr-xr-x 2 root root 0 2018-01-09 11:17 cpuidledrwxr-xr-x 2 root root 0 2018-01-09 11:17 cputopodrwxr-xr-x 2 root root 0 2018-01-09 11:17 eas-r--r--r-- 1 root root 4096 2018-01-09 11:17 isolated-r--r--r-- 1 root root 4096 2018-01-09 11:17 kernel_max-r--r--r-- 1 root root 4096 2018-01-09 11:17 modalias-r--r--r-- 1 root root 4096 2018-01-09 11:17 offline-r--r--r-- 1 root root 4096 2018-01-09 11:17 online [查看 CPU 当前开核]-r--r--r-- 1 root root 4096 2018-01-09 11:17 possibledrwxr-xr-x 2 root root 0 2018-01-09 11:17 power-r--r--r-- 1 root root 4096 2018-01-09 11:17 present [查看 CPU 核数]drwxr-xr-x 2 root root 0 2018-01-09 11:17 rq-statsdrwxr-xr-x 2 root root 0 2018-01-09 11:17 sched-rw-r--r-- 1 root root 4096 2018-01-09 11:17 uevent
adb shell cat /sys/devices/system/cpu/present
Z91:/sys/devices/system/cpu # cat presentcat present0-3
adb shell cat /sys/devices/system/cpu/online
Z91:/sys/devices/system/cpu # cat onlinecat online0-3
adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
Z91:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_frequenciescat scaling_available_frequencies1274000 1235000 1196000 1170000 1105000 1053000 1001000 962000 910000 845000 702000 624000 546000 416000 338000 299000
adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
Z91:/sys/devices/system/cpu/cpu0/cpufreq # cat cpuinfo_cur_freqcat cpuinfo_cur_freq299000
adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
D:\AndroidStudioProject\CpuRun>adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governorsondemand userspace powersave interactive performance sched
adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
D:\AndroidStudioProject\CpuRun>adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governorsched
adb shell “echo 1 > /sys/devices/system/cpu/cpu【index】/online”
adb shell "echo 1 > /sys/devices/system/cpu/cpu1/online"adb shell "echo 1 > /sys/devices/system/cpu/cpu2/online"adb shell "echo 1 > /sys/devices/system/cpu/cpu3/online"
adb shell “echo 0 > /sys/devices/system/cpu/cpu【index】/online”
adb shell "echo 0 > /sys/devices/system/cpu/cpu1/online"adb shell "echo 0 > /sys/devices/system/cpu/cpu2/online"adb shell "echo 0 > /sys/devices/system/cpu/cpu3/online"
adb shell cat /sys/devices/system/cpu/cpu【index】/online
查看单个adb shell cat /sys/devices/system/cpu/cpu1/onlineadb shell cat /sys/devices/system/cpu/cpu2/onlineadb shell cat /sys/devices/system/cpu/cpu3/online查看全部adb shell cat /sys/devices/system/cpu/present
需要事先查看所支持策略类型
adb shell “echo 【governor策略】 > /sys/devices/system/cpu/cpu【index】/cpufreq/scaling_governor”
adb shell "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"adb shell "echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor"adb shell "echo sched > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor"adb shell "echo interactive > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor"查看修改是否成功adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
限制最高频率的阈值或者scaling_setspeed,但是实际设置可能觉得没设置到,其实也是正常的,因为CPU调频和场景相关,比如点开应用和滑动桌面都会频率全开,不受到频率控制,这里走了 CPU 场景调频模式了
adb shell “echo 【频率】 > /sys/devices/system/cpu/cpu【index】/cpufreq/scaling_setspeed”
adb shell “echo 【频率】 > /sys/devices/system/cpu/cpu【index】/cpufreq/cpuinfo_max_freq”
1.查询支持的档位adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies1274000 1235000 1196000 1170000 1105000 1053000 1001000 962000 910000 845000 702000 624000 546000 416000 338000 2990002.查看当前最高频率阈值adb shell "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"adb shell "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"3.设置最高当前最高频率阈值 scaling_setspeedadb shell "echo 845000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"adb shell "echo 845000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"adb shell "echo 1274000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"4.查看当前频率,验证结果adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
转载地址:http://focti.baihongyu.com/