核心调测¶
| 主板 | 主控 | 平台 | NPU |
|---|---|---|---|
| K1 | RK3568 | Rockchip | 1 TOPS |
| K1B | RK3568 | Rockchip | 1 TOPS |
| K1MINI | RK3568 | Rockchip | 1 TOPS |
| K3 | RK3562 | Rockchip | 1 TOPS |
| K3B | RK3562 | Rockchip | 1 TOPS |
| K7 | RK3576 | Rockchip | 6 TOPS |
| K7C | RK3576 | Rockchip | 6 TOPS |
| K7S | RK3576 | Rockchip | 6 TOPS |
| K8 | RK3588 | Rockchip | 6 TOPS |
| K8D | RK3588S2 | Rockchip | 6 TOPS |
| K11C | RK3566 | Rockchip | 1 TOPS |
| 主板 | 主控 | 平台 | NPU |
| K2B | H618 | Allwinner | — |
| K2C | H618 | Allwinner | — |
| K4B | T113 | Allwinner | — |
| K5C | A133 | Allwinner | — |
| K9 | T527 | Allwinner | 2 TOPS |
| K10B | A733 | Allwinner | 3 TOPS |
CPU¶
CPU 信息¶
# CPU 架构和型号
cat /proc/cpuinfo
# 查看处理器个数和型号
cat /proc/cpuinfo | grep "model name" | uniq
cat /proc/cpuinfo | grep "processor" | wc -l
# 使用 lscpu 查看
lscpu
CPU 调频策略¶
Tip
scaling_governor 控制 CPU 频率调节策略:
- performance:最高频率运行,性能最佳
- powersave:最低频率运行,最省电
- ondemand:按需调节(默认)
- conservative:平滑按需调节
- schedutil:调度器驱动调节(较新内核)
# 查看当前频率
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
# 查看可用频率
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
# 查看当前策略
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# 设置为性能模式(所有核心)
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# 设置为省电模式
echo powersave | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
CPU 核心控制¶
# 查看核心在线状态
cat /sys/devices/system/cpu/cpu*/online
# 关闭核心(cpun 替换为实际核心号)
echo 0 > /sys/devices/system/cpu/cpu4/online
# 开启核心
echo 1 > /sys/devices/system/cpu/cpu4/online
CPU 使用率¶
GPU¶
GPU 使用率¶
Tip
不同 GPU 型号的利用率节点路径不同:
- Mali GPU(RK 系列):/sys/devices/platform/*gpu/utilisation
- PowerVR GPU(A733 等):/sys/kernel/debug/pvr/status(搜索 GPU Utilisation 字段)
# Mali GPU
cat /sys/devices/platform/*gpu/utilisation
# PowerVR GPU (A733)
cat /sys/kernel/debug/pvr/status | grep "GPU Utilisation"
# 实时监测
watch -n 1 'cat /sys/devices/platform/*gpu/utilisation'
watch -n 1 "cat /sys/kernel/debug/pvr/status | grep 'GPU Utilisation'"
GLmark2 性能测试¶
Rockchip¶
RK 平台额外提供集成测试脚本:
$ ls /rockchip-test/gpu
gpu_test.sh test_fullscreen_glmark2.sh test_normal_glmark2.sh test_offscreen_glmark2.sh test_stress_glmark2.sh
# 运行 offscreen 测试
root@linaro-alip:/# source /rockchip-test/gpu/test_offscreen_glmark2.sh
======================================================
glmark2 2023.01
======================================================
GL_VENDOR: ARM
GL_RENDERER: Mali-G52
GL_VERSION: OpenGL ES 3.2 v1.g13p0-01eac0.0fd2effaec483a5f4c440d2ffa25eb7a
Surface Size: 800x600 windowed
======================================================
glmark2 Score: 1405
======================================================
NPU¶
A733¶
# 检查 NPU 设备节点
ls -l /dev/vipcore
# 检查 NPU 频率
cat /sys/class/devfreq/3600000.npu/cur_freq
cat /sys/class/devfreq/3600000.npu/available_frequencies
# NPU 推理测试(预置模型)
vpm_run -s /aw-test/npu/vpm_run/a733_sample.txt -l 5 -d 0 --show_top5 1
实测输出示例(A733 VIP Lite 驱动 2.0.3.4):
init vip lite, driver version=0x00020003...
VIPLite driver software library version 2.0.3.4-AW-2025-05-16
vip lite init OK. ← NPU 驱动初始化成功
input 0 dim 224 224 3 1, scale=0.003922 ← 输入图片 224x224 RGB
prepare network 0: 1106 us. ← 模型加载耗时 1.1ms
task: 0, loop count: 1
run time for this network 0: 3446 us.
profile inference time=3144us, cycle=3112073 ← 单次推理耗时 3.1ms
... (共 5 轮循环)
task 0, profile avg inference time=3144us ← 平均推理耗时 3.14ms
vpm run ret=0 ← 测试通过
Rockchip¶
npu 频率测试脚本 npu_freq_scaling.sh:
usage()
{
echo "Usage: npu_freq_scaling.sh [test_second] [every_freq_stay_second]"
echo "example: npu_freq_scaling.sh 3600 30"
echo "means npu_freq_scaling.sh will run 1 hour and every cpu frequency stay 30s"
}
# 变频运行 60 秒,每 10 秒变频一次
$ ./npu_freq_scaling.sh 60 10
npu 压力测试脚本 npu_stress_test.sh:
$ ./npu_stress_test.sh
Begin perf ...
0: Elapse Time = 2.85ms, FPS = 351.12
1: Elapse Time = 2.70ms, FPS = 370.37
...
---- Top5 ----
0.935059 - 156
0.057037 - 155
...
Note
性能测试数据解读:
在 Begin perf... 之后的内容,为模型多次推理的性能指标明细,每项数据包含测试轮次序号、单次推理耗时(Elapse Time)以及每秒推理帧数(FPS)。
推理结果数据解读:
---- Top5 ---- 部分为模型推理输出的置信度排名前五的分类结果。
VPU¶
A733¶
调试信息:
# 开启调试信息
export mpp_syslog_perror=1
echo 0x100 > /sys/module/sunxi_ve/parameters/debug
# 关闭调试信息
export mpp_syslog_perror=0
echo 0x0 > /sys/module/sunxi_ve/parameters/debug
验证硬件解码环境:
# 查看已注册的 OMX 解码器
gst-inspect-1.0 | grep omx
# 查看 cedar_dev 设备节点
ls -la /dev/cedar_dev* /dev/cedarx*
# 查看 sunxi_ve 驱动版本
cat /sys/module/sunxi_ve/version
预期输出:
omx: omxh264dec: OpenMAX H.264 Video Decoder
omx: omxhevcvideodec: OpenMAX H.265 Video Decoder
omx: omxmpeg2videodec: OpenMAX MPEG2 Video Decoder
omx: omxmjpegvideodec: OpenMAX MJPEG Video Decoder
omx: omxmpeg4videodec: OpenMAX MPEG4 Video Decoder
omx: omxvp9videodec: OpenMAX VP9 Video Decoder
GStreamer 硬解码测试:
# H.264 硬解码(fakesink 仅验证链路)
sudo gst-launch-1.0 filesrc location=/usr/local/test.mp4 \
! qtdemux ! h264parse ! omxh264dec ! fakesink -v 2>&1 | head -20
# H.265 硬解码
sudo gst-launch-1.0 filesrc location=/root/test.h265 \
! h265parse ! omxhevcvideodec ! fakesink -v
# 生成解码截图(videotestsrc → 硬编码 → 硬解码 → PNG)
gst-launch-1.0 videotestsrc num-buffers=30 ! videoconvert ! \
video/x-raw,format=NV12,width=640,height=480 ! omxh264videoenc ! \
h264parse ! qtmux ! filesink location=/tmp/test.mp4
gst-launch-1.0 filesrc location=/tmp/test.mp4 ! qtdemux ! h264parse ! \
omxh264dec ! videoconvert ! pngenc ! filesink location=/tmp/vpu_snapshot.png
vpu_snapshot.png 生成成功即表示 H.264 硬编码 + 硬解码链路正常。图为 videotestsrc 标准彩条经 omxh264videoenc 硬编码 → omxh264dec 硬解码后的输出帧:
libcedarc 编解码测试:
# CedarC 硬解码
vdecoderdemo -i /root/test.h264 -codFmat 1 -n 60 -outFmat 6 -o /dev/null
# CedarC 硬编码
vencoderdemo -i /root/test_1920x1080_nv12.yuv -n 30 -f 0 \
-o /root/enc_out.h264 -s 1920x1080 -d 1920x1080 -b 5000 -r 30
Chromium 硬件加速:
预装 chromium-browser-sunxi 包:
# 查看是否安装
dpkg -l | grep chromium-browser-sunxi
# 启动 Chromium(需图形界面)
export DISPLAY=:0
/usr/local/chromium/bin/chromium-browser --no-sandbox file:///usr/local/test.mp4
测试脚本:
# 菜单模式
sudo bash /aw-test/chromium/chromium_test.sh
# 直接运行
sudo bash /aw-test/chromium/test_chromium_with_video.sh
Note
- Chromium 需在物理显示器或 SSH 图形会话下运行,ADB shell 因缺少 D-Bus session 会报错
- 系统已默认通过 LightDM 执行
xhost +,开机即放开 X 访问权限
Rockchip¶
调试信息:
# 开启调试信息
export mpp_syslog_perror=1
echo 0x100 > /sys/module/rk_vcodec/parameters/mpp_dev_debug
# 开启后硬件编解码日志示例
[ 893.134037] rk_vcodec: 27b00100.rkvdec:0 session 3705:19 time: 1333 us hw 1312 us
# 关闭调试信息
export mpp_syslog_perror=0
echo 0x100 > /sys/module/rk_vcodec/parameters/mpp_dev_debug
GStreamer 硬解码测试:
# H.264 硬解码
sudo gst-launch-1.0 filesrc location=/usr/local/test.mp4 \
! qtdemux ! h264parse ! omxh264dec ! fakesink -v 2>&1 | head -20
# H.265 硬解码
sudo gst-launch-1.0 filesrc location=/root/test.h265 \
! h265parse ! omxhevcvideodec ! fakesink -v
Tip
Ubuntu 上 gstreamer 硬件编解码存在兼容性问题,需运行修复脚本:source /rockchip-test/gstreamer/gstreamer_mpp_fix.sh。推荐使用 Debian 系统。
mpi_enc_test 硬编码:
# H.264 4096x2160 100 帧
mpi_enc_test -w 4096 -h 2160 -t 7 -o ./test.h264 -n 100
tail -f /var/log/syslog
# mpi_enc_test: chn 0 encode 100 frames time 3763 ms fps 26.57
# H.265 4096x2160 100 帧
mpi_enc_test -w 4096 -h 2160 -t 16777220 -o ./test.h265 -n 100
tail -f /var/log/syslog
# mpi_enc_test: chn 0 encode 100 frames time 4086 ms fps 24.47
mpi_dec_test 硬解码:
# H.264 4096x2160 100 帧
mpi_dec_test -t 7 -i test.h264 -n 100
tail -f /var/log/syslog
# mpi_dec_test: decode 100 frames time 596 ms fps 167.53
# H.265 4096x2160 100 帧
mpi_dec_test -t 16777220 -i test.h265 -n 100
tail -f /var/log/syslog
# mpi_dec_test: decode 100 frames time 803 ms fps 124.47
Chromium 硬件加速:
# 启动 Chromium 视频测试
source /rockchip-test/chromium/test_chromium_with_video.sh
# 若未调用硬解码,运行修复脚本
source /rockchip-test/chromium/chromium_mpp_fix.sh
Tip
Ubuntu 上 chromium 和 gstreamer 硬件编解码不能同时使用,推荐使用 Debian 系统。
DDR¶
查看内存信息¶
memtester 测试¶
# 安装 memtester
apt install memtester
# 手动测试 512MB 内存 2 轮
memtester 512M 2
# 使用 stress 工具进行内存压力测试
apt install stress
stress --vm 4 --vm-bytes 512M --timeout 60
A733¶
A733 平台未使用标准的 dmc devfreq 接口,DDR 频率由内核自动管理,可通过 clk 节点查看当前频率:
# 查看 DDR PLL 频率
cat /sys/kernel/debug/clk/pll-ddr/clk_rate
# 从 clk_summary 查看
cat /sys/kernel/debug/clk/clk_summary | grep ddr
DMC¶
DDR 频率与调频:
DDR 动态调频通过 dmc(Dynamic Memory Controller)设备管理:
# 查看当前 DDR 频率
cat /sys/class/devfreq/dmc/cur_freq
# 查看可用频率
cat /sys/class/devfreq/dmc/available_frequencies
# 查看当前调频策略
cat /sys/class/devfreq/dmc/governor
# 设置为 userspace 模式手动调频
echo userspace > /sys/class/devfreq/dmc/governor
echo 936000000 > /sys/class/devfreq/dmc/userspace/set_freq
# 恢复为自动调频(如 simple_ondemand)
echo simple_ondemand > /sys/class/devfreq/dmc/governor
DDR 压力测试(/rockchip-test/ddr/):
# 自动检测可用内存,测试一半容量
$ /rockchip-test/ddr/memtester_test.sh
# 24 小时 stressapptest
$ /rockchip-test/ddr/stressapptest_test.sh
# DDR 变频稳定性测试
$ /rockchip-test/ddr/ddr_freq_scaling.sh
# 一键菜单模式
$ /rockchip-test/ddr/ddr_test.sh
核心温度¶
系统按不同硬件模块划分独立温区: