News | About | Get Frugalware | Packages | Documentation | Discussion Forums | Bug Tracker | Wiki | Community | Development

Cpufrequtils

From FrugalWiki

Jump to: navigation, search



    • Cpufrequtils** is a set of utilities designed to assist CPU frequency scaling, a technology used primarily by notebooks that enables the operating system to scale the CPU speed up or down, depending on the current system load.

When used in conjunction with pm-utils, it provides a complete power management suite.

This article covers installation and basic configuration of the cpufrequtils package.

Contents

Installation

Root terminal 48px.png
# pacman-g2 -S cpufrequtils


Configuration

CPU frequency driver

In order for frequency scaling to work properly, the operating system must first know the limits of the CPU(s). To accomplish this, a kernel module is loaded that can read and manage the specifications of the CPU(s).

Most modern notebooks and desktops can simply use the acpi-cpufreq driver. However, other options include the p4-clockmod, powernow-k8, and speedstep-centrino drivers. To see a full list of available drivers, run the following:

User terminal 48px.png
$ ls /lib/modules/*/kernel/arch/*/kernel/cpu/cpufreq
Tip: For an AMD "K10" CPU like Phenom X4, use the powernow-k8 driver.

To load the CPU frequency driver manually:

Intel

Root terminal 48px.png
# modprobe acpi-cpufreq


For older Intel CPUs, the command above may return with:

FATAL: Error inserting acpi_cpufreq ([...]/acpi-cpufreq.ko): No such device

In this case, replace the kernel module acpi-cpufreq with speedstep-centrino, p4-clockmod or speedstep-ich.

    • Notice that the speedstep-centrino module is deprecated.**


AMD

Root terminal 48px.png
# modprobe powernow-k8


Loading at boot

To load the driver automatically at startup, add the appropriate driver to the MODULES array within /etc/sysconfig/modules.

Once the appropriate cpufreq driver is loaded, detailed information about the CPU(s) can be displayed by running:

User terminal 48px.png
$ cpufreq-info

The output should appear similar to the following:

cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Veuillez rapportez les erreurs et les bogues à cpufreq@vger.kernel.org, s'il vous plait.
analyse du CPU 0 :
  pilote : 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.
  limitation matérielle : 1000 MHz - 1.67 GHz
  plage de fréquence : 1.67 GHz, 1.33 GHz, 1000 MHz
  régulateurs disponibles : performance, powersave, ondemand, conservative, userspace
  tactique actuelle : la fréquence doit être comprise entre 1.67 GHz et 1.67 GHz.
                  Le régulateur "performance" est libre de choisir la vitesse
                  dans cette plage de fréquences.
  la fréquence actuelle de ce CPU est 1.67 GHz.
  des statistique concernant cpufreq:1.67 GHz:39,64%, 1.33 GHz:5,80%, 1000 MHz:54,57%  (11126)
analyse du CPU 1 :
  pilote : 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.
  limitation matérielle : 1000 MHz - 1.67 GHz
  plage de fréquence : 1.67 GHz, 1.33 GHz, 1000 MHz
  régulateurs disponibles : performance, powersave, ondemand, conservative, userspace
  tactique actuelle : la fréquence doit être comprise entre 1.67 GHz et 1.67 GHz.
                  Le régulateur "performance" est libre de choisir la vitesse
                  dans cette plage de fréquences.
  la fréquence actuelle de ce CPU est 1.67 GHz.
  des statistique concernant cpufreq:1.67 GHz:39,25%, 1.33 GHz:5,57%, 1000 MHz:55,19%  (10982)

To simply see which governors are available:

User terminal 48px.png
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

Monitoring the CPU speed in real-time can be achieved by running:

User terminal 48px.png
$ watch grep \"cpu MHz\" /proc/cpuinfo

Cpufrequtils

Go through the /etc/sysconfig/cpufreq to define governors, frequencies and policies.

Scaling governors

Governors can be thought of as pre-configured power schemes for the CPU. These governors must be loaded as kernel modules in order to be seen by such programs as kpowersave and gnome-power-manager. One may load as many governors as desired (only one will be active at any given time).

Available governors:

cpufreq_performance (default)
The performance governor is built into the kernel and runs the CPU(s) at maximum clock speed
cpufreq_ondemand (recommended)
Dynamically increases/decreases the CPU(s) clock speed based on system load
cpufreq_conservative
Similar to ondemand, but more conservative (clock speed changes are more graceful)
cpufreq_powersave
Runs the CPU at minimum speed
cpufreq_userspace
Manually configured clock speeds by user

Load the desired governor(s) with modprobe. For example:

Root terminal 48px.png
# modprobe cpufreq_ondemand
Root terminal 48px.png
# modprobe cpufreq_userspace


Or, add the desired governor(s) to the MODULES array in {{Filename|/etc/sysconfig/modules} and reboot.

Manually set the governor by running the cpufreq-set command (as root). However, this setting will not be saved after a reboot/shutdown. For example:

Root terminal 48px.png
# cpufreq-set -g ondemand


Note that the previous command only sets the governor for the first processor. If you have a multicore or multiprocessor system, use the -c flag to set the governor for a specific core. For example, to set the governor for the fourth core (core numbers start from zero):

# cpufreq-set -c 3 -g ondemand

Run cpufreq-set --help or man cpufreq-set for more information.

For those who would like a GUI for setting governors or frequency there is trayfreq, a GTK+ application that sits in the system tray.

Daemon

cpufrequtils also includes a daemon which allows users to set the desired scaling governor and min/max clock speeds for all processor cores at boot-time, without the need for additional tools such as kpowersave.

Before starting the daemon, edit /etc/sysconfig/cpufreq as root, selecting the desired governor and setting the min/max speed for your CPU(s), for example:

File: /etc/conf.d/cpufreq
#configuration for cpufreq control

# valid governors:
#  ondemand, performance, powersave,
#  conservative, userspace
governor="ondemand"

# valid suffixes: Hz, kHz (default), MHz, GHz, THz
min_freq="1GHz"
max_freq="2GHz"
Note: The exact min/max values of the CPU(s) can be determined by running cpufreq-info after loading the CPU driver (e.g. modprobe acpi-cpufreq). However, these values are optional. Users may omit them entirely by deleting or commenting out the min/max_freq lines; scaling will work automatically.

With the appropriate configuration, start the daemon with the following command:

Root terminal 48px.png
# service cpufreq start


To start the daemon automatically at startup,

Root terminal 48px.png
# service cpufreq add


Cpufreqd

A small daemon to adjust cpu speed and voltage (and not only) for kernels using any of the cpufreq drivers available. Cpufreqd is not a userspace governor.

Cpufreqd allows you to apply governor profiles from rules based on battery level, ac status, temperature (ACPI or sensors), running programs, cpu usage and (maybe) more. You can also change your nforce FSB clock and video card frequency (NVidia only) or execute arbitrary commands when a specific rule is applied.

You need a CPU with frequency and voltage scaling capabilities and a Linux kernel with cpufreq support.

Installation

Root terminal 48px.png
# pacman-g2 -S cpufreqd


Daemon

Root terminal 48px.png
# service cpufreqd start
Root terminal 48px.png
# service cpufreqd add


Configuration

See /etc/cpufreqd.conf

Sources

 * https://wiki.archlinux.org/index.php/Cpufrequtils
Personal tools
Namespaces
Variants
Actions