RK3588 CPU GPU NPU 定频和性能模式设置方法以及温度监控

一. CPU定频

1. RK3588的cpu是4个A55+4个A76,分为3组单独管理,节点分别是:

/sys/devices/system/cpu/cpufreq/policy0(对应四个A55:CPU0-CPU3)

1.JPG

 /sys/devices/system/cpu/cpufreq/policy4(对应2个A76:CPU4-CPU5)

1.JPG

 /sys/devices/system/cpu/cpufreq/policy6(对应2个A76:CPU6-CPU7)

1.JPG

以上3个CPU是独立控制,下面以设置CPU6-7为例说明如何设置CPU6-7的频率

2. 获取当前CPU支持的频点

cat /sys/devices/system/cpu/cpufreq/policy6/scaling_available_frequencies

408000 600000 816000 1008000 1200000 1416000 1608000 1800000 2016000 2208000 2304000

3. 获取cpu运行的模式

cat /sys/devices/system/cpu/cpufreq/policy6/scaling_available_governors

conservative ondemand userspace powersave performance schedutil

默认是自动变频模式:schedutil(恢复的话设置为该模式即可)

4. 设置手动定频模式:userspace

echo userspace > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor

5. 设置频率为2016000

echo 2016000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_setspeed

确认是否设置成功

cat /sys/devices/system/cpu/cpufreq/policy6/cpuinfo_cur_freq

2016000

二.GPU定频

1. GPU的节点路径

ls /sys/class/devfreq/fb000000.gpu/

available_frequencies cur_freq governor max_freq name power target_freq trans_stat

available_governors device load min_freq polling_interval subsystem timer uevent

2. 获取GPU支持的频点

cat /sys/class/devfreq/fb000000.gpu/available_frequencies

1000000000 900000000 800000000 700000000 600000000 500000000 400000000 300000000

3. 获取GPU运行的模式

cat /sys/class/devfreq/fb000000.gpu/available_governors

userspace powersave performance simple_ondemand

默认是自动变频模式:simple_ondemand(恢复的话设置为该模式即可)

4. 设置手动定频模式:userspace

echo userspace > /sys/class/devfreq/fb000000.gpu/governor

5. 设置频率为1000000000

echo 1000000000 > /sys/class/devfreq/fb000000.gpu/userspace/set_freq

cat /sys/class/devfreq/fb000000.gpu/cur_freq

6. 查看GPU的负载

cat /sys/class/devfreq/fb000000.gpu/load

0@1000000000Hz

三.NPU定频

1. NPU的节点路径

ls /sys/class/devfreq/fdab0000.npu/

available_frequencies device max_freq polling_interval target_freq uevent

available_governors governor min_freq power timer userspace

cur_freq load name subsystem trans_stat

2. 获取NPU支持的频点

cat /sys/class/devfreq/fdab0000.npu/available_frequencies

300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000

3. 获取NPU运行的模式

cat /sys/class/devfreq/fdab0000.npu/available_governors

userspace powersave performance simple_ondemand

默认是自动变频模式:simple_ondemand(恢复的话设置为该模式即可)

4. 设置手动定频模式:userspace

echo userspace > /sys/class/devfreq/fdab0000.npu/governor

5. 设置频率为1000000000

echo 1000000000 > /sys/class/devfreq/fdab0000.npu/userspace/set_freq

cat /sys/class/devfreq/fdab0000.npu/cur_freq

6. 查看NPU的负载

cat /sys/kernel/debug/rknpu/load

NPU load: Core0: 0%, Core1: 0%, Core2: 0%,

四.RK3588 CPU GPU NPU 温度监控

CPU利用率95%以上时的CPU温升情况,通过使用cpuburn来打满cpu,记录cpu各个核的温度,主要针对一下的cpu

RK3588的芯片有7路TS-ADC分别对应:芯片中心位置、A76_0/1、A76_2/3、DSU 、A55_0/1/2/3、PD_CENTER、 NPU、GPU。

(1)芯片中心位置温度:soc-thermal

(2)CPU大核A76_0/1 即CPU4和CPU5的温度:

(3)CPU大核A76_2/3 即CPU6和CPU7的温度:

(4)CPU小核A55_0/12/3 即CPU0、CPU1、CPU2、CPU3的温度

(5)PD_CENTER的温度:

(6)GPU的温度

(7) NPU的温度

可先运行cpuburn,指定压测核数

cpuburn -n=4

然后执行下面的附件脚本,每十分钟记录一次,记录24小时,一共24*6=144次

#!/bin/bash
if [ -f /tmp/cpu_temper.log ];then
	rm -rf /tmp/cpu_temper.log
fi

for i in {1..144}
do
	echo  "$(date +%Y-%m-%d\ %H:%M:%S)" >> /tmp/cpu_temper.log
	soc_thermal=`cat /sys/class/thermal/thermal_zone0/temp`
	soc_thermal_interger=${soc_thermal:0:2}
	soc_thermal_decimal=${soc_thermal:2:3}
	soc_thermal_float="soc_thermal="${soc_thermal_interger}"."${soc_thermal_decimal}
	CPU_A76_01=`cat /sys/class/thermal/thermal_zone1/temp`
	CPU_A76_01_interger=${CPU_A76_01:0:2}
	CPU_A76_01_decimal=${CPU_A76_01:2:3}
	CPU_A76_01_float="CPU_A76_01="${CPU_A76_01_interger}"."${CPU_A76_01_decimal}
        CPU_A76_23=`cat /sys/class/thermal/thermal_zone2/temp`
	CPU_A76_23_interger=${CPU_A76_23:0:2}
        CPU_A76_23_decimal=${CPU_A76_23:2:3}
        CPU_A76_23_float="CPU_A76_23="${CPU_A76_23_interger}"."${CPU_A76_23_decimal}
	CPU_A55_0123=`cat /sys/class/thermal/thermal_zone3/temp`
	CPU_A55_0123_interger=${CPU_A55_0123:0:2}
        CPU_A55_0123_decimal=${CPU_A55_0123:2:3}
        CPU_A55_0123_float="CPU_A55_0123="${CPU_A55_0123_interger}"."${CPU_A55_0123_decimal}
	PD_CENTER=`cat /sys/class/thermal/thermal_zone4/temp`
        PD_CENTER_interger=${PD_CENTER:0:2}
        PD_CENTER_decimal=${PD_CENTER:2:3}
        PD_CENTER_float="PD_CENTER="${PD_CENTER_interger}"."${PD_CENTER_decimal}
	GPU=`cat /sys/class/thermal/thermal_zone5/temp`
        GPU_interger=${GPU:0:2}
        GPU_decimal=${GPU:2:3}
        GPU_float="GPU="${GPU_interger}"."${GPU_decimal}
	NPU=`cat /sys/class/thermal/thermal_zone6/temp`
        NPU_interger=${NPU:0:2}
        NPU_decimal=${NPU:2:3}
        NPU_float="NPU="${NPU_interger}"."${NPU_decimal}
	line=${soc_thermal_float}"  "${CPU_A76_01_float}"  "${CPU_A76_23_float}"  "${CPU_A55_0123_float}"  "${PD_CENTER_float}"  "${GPU_float}"  "${NPU_float}
	echo $line >> /tmp/cpu_temper.log
	sync
	sleep 600s

done

猜你喜欢

转载自blog.csdn.net/yangwenchao1983/article/details/131758801