surenyi
3 months ago
4 changed files with 179 additions and 0 deletions
Binary file not shown.
@ -0,0 +1,91 @@ |
|||
\chapter{CPU、DDR 和 NPU 频率} |
|||
通常,板子上的各个单元的频率是动态调频,这种情况下测试出来的性能会有波动。为 |
|||
了防止性能测试结果不一致,在性能评估时,建议固定板子上的相关单元的频率再做测试。 |
|||
|
|||
\section{CPU 定频命令} |
|||
|
|||
\subsection{查看 CPU 频率} |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
|||
\end{minted} |
|||
|
|||
\subsection{固定 CPU 频率} |
|||
查看可用的频率 |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies |
|||
\end{minted} |
|||
|
|||
可能的输出如下 |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
408000 600000 816000 1008000 1200000 1416000 1608000 1800000 |
|||
\end{minted} |
|||
|
|||
设置 CPU 频率,如 1.8G |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor |
|||
echo 1800000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed |
|||
\end{minted} |
|||
|
|||
\section{DDR 定频命令} |
|||
|
|||
\subsection{查看 DDR 频率} |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
cat /sys/class/devfreq/dmc/cur_freq |
|||
\end{minted} |
|||
|
|||
\subsection{固定 DDR 频率} |
|||
|
|||
查看 DDR 可用的频率 |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
cat /sys/class/devfreq/dmc/available_frequencies |
|||
\end{minted} |
|||
|
|||
可能的输出如下 |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
528000000 1068000000 1560000000 2112000000 |
|||
\end{minted} |
|||
|
|||
设置 DDR 频率,例如,2112000000MHZ |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
echo userspace > /sys/class/devfreq/dmc/governor |
|||
echo 2112000000 > /sys/class/devfreq/dmc/userspace/set_freq |
|||
\end{minted} |
|||
|
|||
\section{NPU 相关} |
|||
|
|||
\subsection{查看 NPU 频率} |
|||
用下面命令查看: |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
cat /sys/kernel/debug/clk/clk_summary | grep clk_npu_dsu0 |
|||
\end{minted} |
|||
可能的输出如下: |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
clk_npu_dsu0 3 6 0 250000000 0 0 50000 |
|||
\end{minted} |
|||
|
|||
\subsection{设置 NPU 频率(需要固件支持)} |
|||
例如,设置为 1GHz |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
echo 1000000000 > /sys/kernel/debug/clk/clk_npu_dsu0/clk_rate |
|||
\end{minted} |
|||
|
|||
\subsection{查询 NPU 驱动版本} |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
[root@openEuler ~]# cat /sys/kernel/debug/rknpu/version |
|||
RKNPU driver: v0.8.2 |
|||
\end{minted} |
|||
|
|||
\subsection{查询 NPU 电源状态} |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
cat /sys/kernel/debug/rknpu/power |
|||
\end{minted} |
|||
|
|||
\subsection{打开 NPU 电源} |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
echo on > /sys/kernel/debug/rknpu/power |
|||
\end{minted} |
|||
|
|||
\subsection{关闭 NPU 电源} |
|||
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|||
echo off > /sys/kernel/debug/rknpu/power |
|||
\end{minted} |
Loading…
Reference in new issue