MTK Android常用的命令记录(CPU/GPU频率调整等)


Creative Commons LicenseCreative Commons LicenseCreative Commons License

1 查看CPU频率

1
2
3
4
5
/ # cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq           
1050000
1050000
1050000
1050000

2 使用GPU Procfs接口查看设置频率等

1
2
3
1)查看当前频率
/ # cat /sys/kernel/debug/ged/hal/current_freqency
/ # cat /proc/gpufreq/gpufreq_var_dump
1
2
3
4
5
6
7
8
9
10
11
12
13
GPU current frequency = 299000KHz
Current Vcore = 1150mV
g_cur_gpu_OPPidx = 2
g_last_gpu_dvs_result = 127 (0:success, 127:not enabled, else:error)
g_limited_max_id = 0
mt_gpufreq_power_limited_index_array[0] = 0
mt_gpufreq_power_limited_index_array[1] = 0
mt_gpufreq_power_limited_index_array[2] = 0
mt_gpufreq_power_limited_index_array[3] = 0
mt_gpufreq_volt_enable_state = 0
mt_gpufreq_fixed_freq_state = 0
mt_gpufreq_dvfs_table_type = 2
mt_gpufreq_dvfs_mmpll_spd_bond = 5
1
2
3
# GPU可以开启GPU柱状图显示,使用命如下令进入原生设置界面
# am start -n com.android.settings/.Settings
# -->开发者选项-->GPU呈现模式分析-->在屏幕上显示为条形图

2)GPU固定频率等接口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/proc/mali # cat /proc/mali/help                                           
======================================================================
A.For Query GPU/CPU related Command:
cat /proc/mali/utilization
cat /proc/mali/frequency
cat /proc/mali/memory_usage
======================================================================
B.For Fix GPU Frequency:
echo > (450000, 280000) /proc/gpufreq/gpufreq_opp_freq
echo 0 > /proc/gpufreq/gpufreq_opp_freq(re-enable GPU DVFS)
C.For Turn On/Off CPU core number:
echo (1, 0) > /sys/devices/system/cpu/cpu1/online
echo (1, 0) > /sys/devices/system/cpu/cpu2/online
echo (1, 0) > /sys/devices/system/cpu/cpuN/online
D.For CPU Performance mode(Force CPU to run at highest speed:
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor(re-enable CPU DVFS)
==============================================================================================
E.For GPU advanced debugging command:
echo [dvfs_freq(ms)] > /proc/mali/dvfs_freq
echo [dvfs_thr_max] [dvfs_thr_min] > /proc/mali/dvfs_threshold
echo [dvfs_deferred_count] > /proc/mali/dvfs_deferred_count
==============================================================================================

1
2
3
4
5
6
7
#方法1:
echo 520000 >gpufreq_fixed_freq
#方法2:
echo 1 >/proc/gpufreq/gpufreq_state
cat /proc/gpufreq/gpufreq_state
GPU DVFS disabled
echo 520000 >/proc/gpufreq/gpufreq_opp_freq

3) 查看GPU电压频率控制列表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/ # cat /proc/gpufreq/gpufreq_power_dump                                           <
mt_gpufreqs_power[0].gpufreq_khz = 520000
mt_gpufreqs_power[0].gpufreq_volt = 115000
mt_gpufreqs_power[0].gpufreq_power = 828
mt_gpufreqs_power[1].gpufreq_khz = 416000
mt_gpufreqs_power[1].gpufreq_volt = 115000
mt_gpufreqs_power[1].gpufreq_power = 662
mt_gpufreqs_power[2].gpufreq_khz = 416000
mt_gpufreqs_power[2].gpufreq_volt = 115000
mt_gpufreqs_power[2].gpufreq_power = 662
mt_gpufreqs_power[3].gpufreq_khz = 299000
mt_gpufreqs_power[3].gpufreq_volt = 115000
mt_gpufreqs_power[3].gpufreq_power = 475
mt_gpufreqs_power[4].gpufreq_khz = 299000
mt_gpufreqs_power[4].gpufreq_volt = 115000
mt_gpufreqs_power[4].gpufreq_power = 475
mt_gpufreqs_power[5].gpufreq_khz = 299000
mt_gpufreqs_power[5].gpufreq_volt = 115000
mt_gpufreqs_power[5].gpufreq_power = 475

4)其他sys目录下的gpu接口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/ # find /sys -name gpu*
/sys/devices/soc/13040000.gpu/gpuinfo
/sys/firmware/devicetree/base/soc/gpu@13040000
/sys/kernel/debug/mali0/gpu_memory
/sys/kernel/debug/ged/hal/gpu_utilization
/sys/kernel/debug/ged/logbufs/gpuinfo
/sys/kernel/debug/tracing/events/mtk_events/gpu_freq
/sys/module/ged/parameters/gpu_idle
/sys/module/ged/parameters/gpu_dvfs_enable
/sys/module/ged/parameters/gpu_block
/sys/module/ged/parameters/gpu_loading
/sys/module/ged/parameters/gpu_cust_boost_freq
/sys/module/ged/parameters/gpu_cust_upbound_freq
/sys/module/ged/parameters/gpu_debug_enable
/sys/module/ged/parameters/gpu_bottom_freq

3 温度监测

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
1)查看所有温度传感器的温度
/ # cat /sys/devices/virtual/thermal/thermal_zone*/temp
37000
48300
47100
48300
47700
47700
-127000
54985
38000

2)对应温度传感器的名称
/ # cat /sys/devices/virtual/thermal/thermal_zone*/type
mtktswmt //wifi温度
mtktscpu // CPU
mtkts1
mtkts5
mtkts3
mtkts4
mtktsbattery //电池
mtktspmic //电源管理芯片
mtktsAP

4)其他温度接口
/ # cat /proc/driver/thermal/tzpmic
[ mtktspmic_read] trip_0_temp=145000,trip_1_temp=110000,trip_2_temp=100000,trip_3_temp=90000,trip_4_temp=80000,
trip_5_temp=70000,trip_6_temp=65000,trip_7_temp=60000,trip_8_temp=55000,trip_9_temp=50000,
g_THERMAL_TRIP_0=0,g_THERMAL_TRIP_1=0,g_THERMAL_TRIP_2=0,g_THERMAL_TRIP_3=0,g_THERMAL_TRIP_4=0,
g_THERMAL_TRIP_5=0,g_THERMAL_TRIP_6=0,g_THERMAL_TRIP_7=0,g_THERMAL_TRIP_8=0,g_THERMAL_TRIP_9=0,
cooldev0=mtktspmic-sysrst,cooldev1=no-cooler,cooldev2=no-cooler,cooldev3=no-cooler,cooldev4=no-cooler,
cooldev5=no-cooler,cooldev6=no-cooler,cooldev7=no-cooler,cooldev8=no-cooler,cooldev9=no-cooler,time_ms=1000

/ # cat /proc/driver/thermal/tzcpu
[tscpu_read]6
trip_0=117000 0 mtktscpu-sysrst //117度CPU会复位
trip_1=100000 0 mtk-cl-shutdown00 //100度关机
trip_2=95000 0 cpu02
trip_3=90000 0 cpu_adaptive_0
trip_4=76000 0 cpu_adaptive_1
trip_5=68000 0 cpu_adaptive_2
trip_6=45000 0 no-cooler
trip_7=35000 0 no-cooler
trip_8=25000 0 no-cooler
trip_9=15000 0 no-cooler

4 CPU调整性能模式

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor

5 其他命令记录

1
2
3
4
/ # wm size
Physical size: 1024x600
/ # wm density
Physical density: 160
1
2
3
# 命令行开启设置和工程模式
am start -n com.android.settings/.Settings
am start -n com.mediatek.engineermode/com.mediatek.engineermode.EngineerMode

一些参考文献

https://www.kancloud.cn/kancloud/android-performance/53238
http://hukai.me/android-performance-patterns-season-4/
http://hukai.me/android-performance-patterns-season-5/
http://hukai.me/android-performance-patterns-season-6/

-------------本文结束感谢您的阅读-------------
如果文章对您有帮助,也可以打赏支持喔!