Kubuntu Terminal

cpufreq-set great little tool to change the frequency scalling of the CPU

If you have a laptop then you already know about frequency scaling. If you ever watched you CPU frequency while you plugged you laptop in to the wall socket. Guidance will pop-up when the laptop is plugged in telling you that you laptop is now in “performance” mode.

Why do you need CPU scaling?
Scaling in a laptop is used to conserve battery power when on battery power. How ever on a regular desktop you will find CPU scaling is on as well, why you might ask? On a desktop it’s a noise thing lowering the CPU frequency reduces heat and therefore reduces the fan speed needed to cool the CPU.

However I happen to like to have my desktop run in “performance” mode all the time, with the case that I have the increase of noise from the CPU fan is hardly noticeable because of the great noise canceling isolation in the case.

This is easily done by running a command in Terminal. But who can really remember the enormous line you have to put in to change the setting in the governor. There is an handy package we can install to control CPU scaling called cpufreq-set. Let’s install the package.

sudo apt-get install cpufrequtils

What does this give us? The two most important tools are cpufreq-set and cpufreq-info.

cpufreq-info

This will give you information about you’re CPU(‘s if you have a dual core).
Here is the result of my laptop:

cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 800 MHz - 1.73 GHz
  available frequency steps: 1.73 GHz, 1.33 GHz, 1.07 GHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 800 MHz and 1.73 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 1.73 GHz.
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 800 MHz - 1.73 GHz
  available frequency steps: 1.73 GHz, 1.33 GHz, 1.07 GHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 800 MHz and 1.73 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 1.73 GHz.

cpufreq-set is the one we want though this will allow us to set the governor to what ever we want.

The following command will tell us what modes are available.

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

The outcome:

conservative ondemand userspace powersave performance

This command will tel us what it is currently set on.

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

The outcome:

performance

This means we can set the following modes:
conservative, ondemand, userspace, powersave and performance

I’m going to set it to performance:

sudo cpufreq-set -g performance

Now you will see that the frequency will stay close to as high as it can go.

We could set it to userspace and then set the frequency manually.

sudo cpufreq-set -g userspace

Then set the frequency.

sudo cpufreq-set -f 1733000

Now the frequency will be 1.73Ghz.

Note: After a restart the governor will be set back to what is the default. You could switch off the powernow daemon. Or prevent this from happening by setting a root crontab entry.

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered by: Wordpress
diamond buyer