当前位置:   article > 正文

linux CPU主频设置_scaling_cur_freq

scaling_cur_freq

CPU主频相关信息

root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# ls
affected_cpus                  scaling_cur_freq
cpuinfo_cur_freq               scaling_driver
cpuinfo_max_freq               scaling_governor
cpuinfo_min_freq               scaling_max_freq
cpuinfo_transition_latency     scaling_min_freq
related_cpus                   scaling_setspeed
scaling_available_frequencies  stats
scaling_available_governors
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 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 频率,增加性能.
root@ATK-IMX6U:~# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
792000
  • 1
  • 2
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
198000 396000 528000 792000
  • 1
  • 2
root@ATK-IMX6U:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 12.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : Freescale i.MX6 Ultralite (Device Tree)
Revision        : 0000
Serial          : 0000000000000000
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

BogoMIPS 为 12.00,处理器性能越强,主频越高,BogoMIPS 值就越大。

查看内核中的主频属性设置

CPU Power Management
	-> CPU Frequency scaling
		-> CPU Frequency scaling
			-> Default CPUFreq governor
  • 1
  • 2
  • 3
  • 4

在这里插入图片描述
但是在以后的实际产品开发中,从省电的角度考虑,建议使用 ondemand 模式,一来可以省电,二来可以减少发热。

修改模式为 ondemand

在这里插入图片描述

编译后zImage ,启动后查看参数

root@ATK-IMX6U:~# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
528000
  • 1
  • 2

当前频率降低了,为528M

root@ATK-IMX6U:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 6.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : Freescale i.MX6 Ultralite (Device Tree)
Revision        : 0000
Serial          : 0000000000000000

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

BogoMIPS 数值变小了

添加新频率696MHz

修改方法 设备树文件 arch/arm/boot/dts/imx6ull.dtsi

        cpus {
                #address-cells = <1>;
                #size-cells = <0>;

                cpu0: cpu@0 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
                        reg = <0>;
                        clock-latency = <61036>; /* two CLK32 periods */
                        operating-points = <
                                /* kHz  uV */
                                996000  1275000
                                792000  1225000
                                528000  1175000
                                396000  1025000
                                198000  950000
                        >;
                        fsl,soc-operating-points = <
                                /* KHz  uV */
                                996000  1175000
                                792000  1175000
                                528000  1175000
                                396000  1175000
                                198000  1175000
                        >;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

加入针对 696MHz 的支持


        cpus {
                #address-cells = <1>;
                #size-cells = <0>;

                cpu0: cpu@0 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
                        reg = <0>;
                        clock-latency = <61036>; /* two CLK32 periods */
                        operating-points = <
                                /* kHz  uV */
                                996000  1275000
                                792000  1225000
                                696000 1175000
                                528000  1175000
                                396000  1025000
                                198000  950000
                        >;
                        fsl,soc-operating-points = <
                                /* KHz  uV */
                                996000  1175000
                                792000  1175000
                                696000 1175000
                                528000  1175000
                                396000  1175000
                                198000  1175000
                        >;

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  dtbs
  • 1

编译完成以后使用新的设备 树 文 件 imx6ull-alientek_emmc.dtb 启 动 Linux

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
198000 396000 528000 696000 792000
  • 1
  • 2

选项中有696M频率

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/224977
推荐阅读
相关标签
  

闽ICP备14008679号