修改CPU频率

方法一:修改内核

查看CPU 当前的工作频率

cd /sys/bus/cpu/devices/cpu0/cpufreq
cat cpuinfo_cur_freq

在这里插入图片描述

cpuinfo_cur_freq:				当前 cpu 工作频率,从 CPU 寄存器读取到的工作频率。
cpuinfo_max_freq:				处理器所能运行的最高工作频率(单位: KHz)。
cpuinfo_min_freq :				处理器所能运行的最低工作频率(单位: KHz)。
cpuinfo_transition_latency:	处理器切换频率所需要的时间(单位:ns)。
scaling_available_frequencies:	处理器支持的主频率列表(单位: KHz)。
scaling_available_governors:	当前内核中支持的所有 governor(调频)类型。
scaling_cur_freq:				保存着 cpufreq 模块缓存的当前 CPU 频率,不会对 CPU 硬件寄存器进行检查。
scaling_driver:				该文件保存当前 CPU 所使用的调频驱动。
scaling_governor:				governor(调频)策略,Linux 内核一共有 5 中调频策略,
	Performance,				最高性能,直接用最高频率,不考虑耗电。
	Interactive,				一开始直接用最高频率,然后根据 CPU 负载慢慢降低。
	Powersave,					省电模式,通常以最低频率运行,系统性能会受影响,一般不会用这个!
	Userspace,					可以在用户空间手动调节频率。
	Ondemand,					定时检查负载,然后根据负载来调节频率。负载低的时候降低 CPU 频率,负载高的时候提高 CPU 频率
scaling_max_freq:				governor(调频)可以调节的最高频率。
cpuinfo_min_freq:				governor(调频)可以调节的最低频率。
stats 目录下给出了 CPU 各种运行频率的统计情况,比如 CPU 在各频率下的运行时间以及变频次数。

修改调频策略

将调频策略修改为performance
方法一:

vi ./arch/arm/configs/imx_victor_emmc_defconfig

在这里插入图片描述
方法二:

vi ./arch/arm/configs/imx_victor_emmc_defconfig
make imx_victor_emmc_defconfig
make menuconfig

在这里插入图片描述

CPU Power Management  --->
	CPU Frequency scaling  --->
		Default CPUFreq governor (ondemand)  --->
			performance

方法二:使用cpufrequtils

安装:sudo apt install cpufrequtils

查看cpu类型、当前频率、支持频率、运行模式等

cpufreq-info -m
root@localhost:~# cpufreq-info -m
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: qoriq_cpufreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 31 ns.
  hardware limits: 500 MHz - 1.60 GHz
  available frequency steps: 1.60 GHz, 1000 MHz, 800 MHz, 500 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 500 MHz and 1.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1000 MHz (asserted by call to hardware).
  cpufreq stats: 1.60 GHz:4.76%, 1000 MHz:0.99%, 800 MHz:1.72%, 500 MHz:92.53%  (530)
analyzing CPU 1:
  driver: qoriq_cpufreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 31 ns.
  hardware limits: 500 MHz - 1.60 GHz
  available frequency steps: 1.60 GHz, 1000 MHz, 800 MHz, 500 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 500 MHz and 1.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1000 MHz (asserted by call to hardware).
  cpufreq stats: 1.60 GHz:4.76%, 1000 MHz:0.99%, 800 MHz:1.72%, 500 MHz:92.53%  (530)
analyzing CPU 2:
  driver: qoriq_cpufreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 31 ns.
  hardware limits: 500 MHz - 1.60 GHz
  available frequency steps: 1.60 GHz, 1000 MHz, 800 MHz, 500 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 500 MHz and 1.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1000 MHz (asserted by call to hardware).
  cpufreq stats: 1.60 GHz:4.76%, 1000 MHz:0.99%, 800 MHz:1.72%, 500 MHz:92.53%  (530)
analyzing CPU 3:
  driver: qoriq_cpufreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 31 ns.
  hardware limits: 500 MHz - 1.60 GHz
  available frequency steps: 1.60 GHz, 1000 MHz, 800 MHz, 500 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 500 MHz and 1.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1000 MHz (asserted by call to hardware).
  cpufreq stats: 1.60 GHz:4.76%, 1000 MHz:0.99%, 800 MHz:1.72%, 500 MHz:92.53%  (530)

调整整体工作模式

cpufreq-set -g performance

调整某个核的工作模式

cpufreq-set -g performance -c CPU序列

手动调节频率

cpufreq-set -g userspace -d 800MHz -u 1000MHz

注:方法二为临时调整,想要永久调整可以添加至自启动服务中

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

u.意思

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值