How to use cpufrequtils

From ThinkWiki
Jump to: navigation, search
NOTE!
See the Dynamic Frequency Scaling HOWTO on how to avoid using cpu frequency scaling daemons by using the kernel builtin ondemand governor.

Contents

What is it?

cpufrequtils is used to control the CPU frequency scaling deamon (speedstep, throttling, ...).

This package mainly has 2 programs:

/usr/bin/cpufreq-info
/usr/bin/cpufreq-set

It's basically a user-friendly alternative to using the Sys interface.

Frequency scaling allows you to set the CPU frequency on-the-fly or specify an automatic governor. By lowering the CPU frequency when your computer is idle, you can preserve a lot of battery power and keep the system cool.

By default most systems use the ondemand governor. For battery powered environments, the conservative and powersave governors are more favorable.

Installation

Ubuntu

To install it on Ubuntu, install the package cpufrequtils from your package manager or a terminal:

user@host:~$ sudo aptitude install cpufrequtils


Using cpufrequtils

cpufreq-info

Gives general CPU information:

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

cpufreq-set

Allows setting

-d  minimum frequency,
-u  maximum frequency,
-f  specific frequency (userspace governor must be set first) and
-g  governor on a
-c  specific CPU.

cpufreq-set needs root privileges in order to work.

Examples

NOTE!
Use cpufreq-info to see which frequencies and governors are available for your CPU. Examples were made on a Z60m with Intel Pentium M 2.0Ghz.
NOTE!
sudo is used in these examples to grant root privileges.

Activate the conservative governor to save a little extra power by letting the CPU stay longer at each frequency step before changing:

user@host:~$ sudo cpufreq-set -g conservative

Set the upper frequency limit to 1.6Ghz:

user@host:~$ sudo cpufreq-set -u 1.6Ghz

Manually set the frequency to a constant 800Mhz (userspace governor):

user@host:~$ sudo cpufreq-set -g userspace
user@host:~$ sudo cpufreq-set -f 800Mhz
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox