Difference between revisions of "How to use cpufrequtils"

From ThinkWiki
Jump to: navigation, search
m (notes update in examples section)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{NOTE|See the [[How_to_make_use_of_Dynamic_Frequency_Scaling|Dynamic Frequency Scaling HOWTO]] on how to avoid using cpu frequency scaling daemons by using the kernel builtin ondemand governor.}}
 
{{NOTE|See the [[How_to_make_use_of_Dynamic_Frequency_Scaling|Dynamic Frequency Scaling HOWTO]] on how to avoid using cpu frequency scaling daemons by using the kernel builtin ondemand governor.}}
  
 +
==What is it?==
 +
cpufrequtils is used to control the CPU frequency scaling deamon (speedstep, throttling, ...).
  
 
This package mainly has 2 programs:
 
This package mainly has 2 programs:
 
:{{path|/usr/bin/cpufreq-info}}
 
:{{path|/usr/bin/cpufreq-info}}
 
:{{path|/usr/bin/cpufreq-set}}
 
:{{path|/usr/bin/cpufreq-set}}
 +
It's basically a user-friendly alternative to using the [[How_to_make_use_of_Dynamic_Frequency_Scaling#Using_the_Sys_Interface|Sys interface]].
  
cpufreq-info gives general device information:
+
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.
  xaiki@gonzo:~$ cpufreq-info
+
 
  cpufrequtils 0.2: cpufreq-info (C) Dominik Brodowski 2004
+
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.
 
  Report errors and bugs to linux@brodo.de, please.
 
  analyzing CPU 0:
 
  analyzing CPU 0:
   driver: speedstep-smi
+
   driver: centrino
 
   CPUs which need to switch frequency at the same time: 0
 
   CPUs which need to switch frequency at the same time: 0
   hardware limits: 500 MHz - 700 MHz
+
   hardware limits: 798 MHz - 2.00 GHz
   available frequency steps: 700 MHz, 500 MHz
+
   available frequency steps: 798 MHz, 1.06 GHz, 1.33 GHz, 1.60 GHz, 2.00 GHz
   available cpufreq governors: userspace, performance
+
   available cpufreq governors: userspace, ondemand, conservative, powersave, performance
   current policy: frequency should be within 500 MHz and 700 MHz.
+
   current policy: frequency should be within 798 MHz and 2.00 GHz.
                   The governor "userspace" may decide which speed to use
+
                   The governor "conservative" may decide which speed to use
 
                   within this range.
 
                   within this range.
   current CPU frequency is 700 MHz.
+
   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.}}
  
and cpufreq-set allows setting
+
Activate the ''conservative'' governor to save a little extra power by letting the CPU stay longer at each frequency step before changing:
... Never got it working ...
+
user@host:~$ sudo cpufreq-set -g conservative
  
I've got -- you need to get userspace governor active:
+
Set the upper frequency limit to 1.6Ghz:
# modprobe speedstep-ich cpufreq_userspace
+
user@host:~$ sudo cpufreq-set -u 1.6Ghz
# echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
 
  
Then cpufreq-set -f 500000 (or 700000) should do the job.
+
Manually set the frequency to a constant 800Mhz (userspace governor):
 +
user@host:~$ sudo cpufreq-set -g userspace
 +
user@host:~$ sudo cpufreq-set -f 800Mhz

Latest revision as of 15:25, 2 May 2007

NOTE!
See the Dynamic Frequency Scaling HOWTO on how to avoid using cpu frequency scaling daemons by using the kernel builtin ondemand governor.

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