如何将 cpufreq 调节器设置为性能?

如何将 cpufreq 调节器设置为性能?

我使用的是 Ubuntu 13.04 64 位。我听说将 cpufreq 调节器设置为 performance 会提高性能。不幸的是,我在这方面有点新手,我不确定该怎么做。如果我这样做,我会sudo cpufreq-set -c 0 -g performance得到:

Error setting new values. Common errors:
- Do you have proper administration rights? (super-user?)
- Is the governor you requested available and modprobed?
- Trying to set an invalid policy?
- Trying to set a specific frequency, but userspace governor is not available,
   for example because of hardware which cannot be set to a specific frequency
   or because the userspace governor isn't loaded?

cpufreq-info 给我:

cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], please.
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
analyzing CPU 1:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.

这是 cat /proc/cpuinfo 的输出

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 15
model       : 4
model name  : Intel(R) Pentium(R) D CPU 2.80GHz
stepping    : 4
microcode   : 0x6
cpu MHz     : 2800.026
cache size  : 1024 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 5
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc pebs bts nopl pni dtes64 monitor ds_cpl cid cx16 xtpr
bogomips    : 5600.05
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 15
model       : 4
model name  : Intel(R) Pentium(R) D CPU 2.80GHz
stepping    : 4
microcode   : 0x6
cpu MHz     : 2800.026
cache size  : 1024 KB
physical id : 0
siblings    : 2
core id     : 1
cpu cores   : 2
apicid      : 1
initial apicid  : 1
fpu     : yes
fpu_exception   : yes
cpuid level : 5
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc pebs bts nopl pni dtes64 monitor ds_cpl cid cx16 xtpr
bogomips    : 5600.05
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 48 bits virtual
power management:

任何帮助,将不胜感激。

答案1

我怀疑 P4 硬件不支持您尝试设置的 CPU 扩展类型。实际上,您的 P4 CPU 已全速运行。

您可以使用命令 cpufreq-info 获取有关硬件功能的信息。它将告诉您可以使用的有效设置。在 P4 系统上,我得到以下信息:

cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], please.
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 0.00 ms.
analyzing CPU 1:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 0.00 ms.

在较新的 Core2Duo 系统上,我得到了以下信息:

cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1000 MHz - 2.17 GHz
  available frequency steps: 2.17 GHz, 2.00 GHz, 1.83 GHz, 1.67 GHz, 1.50 GHz, 1.33 GHz, 1000 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 1000 MHz and 2.17 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1000 MHz.
  cpufreq stats: 2.17 GHz:4.03%, 2.00 GHz:0.01%, 1.83 GHz:0.01%, 1.67 GHz:0.01%, 1.50 GHz:0.01%, 1.33 GHz:5.14%, 1000 MHz:90.80%  (28070386)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 10.0 us.
  hardware limits: 1000 MHz - 2.17 GHz
  available frequency steps: 2.17 GHz, 2.00 GHz, 1.83 GHz, 1.67 GHz, 1.50 GHz, 1.33 GHz, 1000 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 1000 MHz and 2.17 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1000 MHz.
  cpufreq stats: 2.17 GHz:2.88%, 2.00 GHz:0.00%, 1.83 GHz:0.00%, 1.67 GHz:0.01%, 1.50 GHz:0.01%, 1.33 GHz:1.87%, 1000 MHz:95.23%  (3085131)

答案2

这里没有可报告的错误。

你的 CPU 似乎P4D820,它没有任何速度步骤。它也没有 Turboboost。所以 cpufreq 什么也做不了。

充分利用 CPU 的最佳方法是在 BIOS 中进行超频。:)

答案3

可能存在禁用 CPU 频率缩放的 BIOS 设置...我不太了解 P4 的具体情况,但我知道在某些 AMD 上,它们可以设置为最大频率而不进行缩放(也许在 BIOS 中禁用 Cool'n'quiet 或类似功能?)

另外,如果没有安装电池(Thinkpad),一些笔记本电脑可能会禁用频率缩放并仅以最低的 CPU 速度运行,原因是交流适配器无法为全频率提供足够的电力...

在放弃频率缩放之前需要检查一些事情,特别是如果您的 CPU 制造商表示支持它。

相关内容