You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.7 KiB

\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}
可能的输出如下(单位是 kHZ):
\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 频率,例如,2112000000 HZ
\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}
\chapter{U-Boot 快捷键}
RK平台提供串口组合键触发一些事件用于调试、烧写(如果无法触发,请多尝试几次;启用 secure-boot
时无效)。\textbf{开机时长按}
\begin{itemize}[itemsep=0pt,topsep=0pt,parsep=0pt]
\item \texttt{ctrl+c:}进入 U-Boot 命令行模式;
\item \texttt{ctrl+d:}进入 loader 烧写模式;
\item \texttt{ctrl+b:}进入 maskrom 烧写模式;
\item \texttt{ctrl+f:}进入 fastboot 模式;
\item \texttt{ctrl+m:}打印 bidram/system 信息;
\item \texttt{ctrl+i:}使能内核 initcall\_debug;
\item \texttt{ctrl+p:}打印 cmdline 信息;
\item \texttt{ctrl+s:}``Starting kernel...'' 之后进入 U-Boot 命令行;
\end{itemize}