Controlling CPU frequency

We can control the CPU frequency with the cpufrequtils package. Installation is quite easy.

$ sudo aptitude install  cpufrequtils

To check to see if it’s installed.

[06:41:32] xavi@debian: ~ $ lsmod | grep -i cpu
acpi_cpufreq            6796  1 
cpufreq_powersave       1856  0 
cpufreq_stats           3776  0 
cpufreq_ondemand        6476  1 
freq_table              4224  3 acpi_cpufreq,cpufreq_stats,cpufreq_ondemand
cpufreq_userspace       3172  0 
cpufreq_conservative     5960  0 
processor              32576  4 acpi_cpufreq,thermal
[06:45:26] xavi@debian: ~ $ 


Now we check the CPU frequency.

[05:43:20] xavi@debian: ~ $ cat /proc/cpuinfo | grep -i hz
model name	: Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
cpu MHz		: 800.000
model name	: Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
cpu MHz		: 800.000
[05:43:40] xavi@debian: ~ $ 

We see we have a CPU capable of running at 2.40GHz. Now lets check the speed at which is running now.

[05:43:40] xavi@debian: ~ $ cpufreq-info 
cpufrequtils 004: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to cpufreq@lists.linux.org.uk, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 800 MHz - 2.40 GHz
  available frequency steps: 2.40 GHz, 2.40 GHz, 1.60 GHz, 800 MHz
  available cpufreq governors: powersave, ondemand, userspace, conservative, performance
  current policy: frequency should be within 800 MHz and 2.40 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
  cpufreq stats: 2.40 GHz:13,14%, 2.40 GHz:0,66%, 1.60 GHz:2,10%, 800 MHz:84,11%  (30059)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 800 MHz - 2.40 GHz
  available frequency steps: 2.40 GHz, 2.40 GHz, 1.60 GHz, 800 MHz
  available cpufreq governors: powersave, ondemand, userspace, conservative, performance
  current policy: frequency should be within 800 MHz and 2.40 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
  cpufreq stats: 2.40 GHz:13,14%, 2.40 GHz:0,66%, 1.60 GHz:2,10%, 800 MHz:84,11%  (30059)
[05:44:56] xavi@debian: ~ $ 

We see is running most of the time at 800 MHz. Lets go ahead and increase the CPU speed.

[05:44:56] xavi@debian: ~ $ sudo cpufreq-set -c 1 -d 2401000 -u 2401000; echo $?
[sudo] password for xavi: 
0
[05:46:31] xavi@debian: ~ $ 

On the previous command -d selects the minimum speed and -u selects the maximum speed. Now lets check the new speed.

[05:47:00] xavi@debian: ~ $ cpufreq-info ; date
cpufrequtils 004: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to cpufreq@lists.linux.org.uk, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 800 MHz - 2.40 GHz
  available frequency steps: 2.40 GHz, 2.40 GHz, 1.60 GHz, 800 MHz
  available cpufreq governors: powersave, ondemand, userspace, conservative, performance
  current policy: frequency should be within 2.40 GHz and 2.40 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 2.40 GHz.
  cpufreq stats: 2.40 GHz:13,28%, 2.40 GHz:0,65%, 1.60 GHz:2,09%, 800 MHz:83,98%  (30177)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 800 MHz - 2.40 GHz
  available frequency steps: 2.40 GHz, 2.40 GHz, 1.60 GHz, 800 MHz
  available cpufreq governors: powersave, ondemand, userspace, conservative, performance
  current policy: frequency should be within 2.40 GHz and 2.40 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 2.40 GHz.
  cpufreq stats: 2.40 GHz:13,28%, 2.40 GHz:0,65%, 1.60 GHz:2,09%, 800 MHz:83,98%  (30177)
Xov Set  2 05:47:14 EDT 2010
[05:47:14] xavi@debian: ~ $ 

We clearly see speed has been increased to 2.4 GHz which is the maximum speed this box of capable to work at.

Leave a Reply