Powernowd
From ArchWiki
Contents |
Summary
Powernowd is a very simple program that will adjust the speed of your CPU depending on system load. It is more flexible than the ondemand profile in cpufrequtils because you set the low/high thresholds of CPU use to trigger a step from low multipler to high multiplier rather than relying on the 'ondemand' profile.
Features
- One, simple heuristic to determine CPU load: "user + sys" time.
- Ignore "niced" programs (setiathome, itself, etc). In my mind this is consistent with what is meant when someone 'nice's a program to begin with. (configurable in v0.85+)
- Designed for CPU's that support more then two speed states, but works well with anything.
- Very fast, low overhead /proc/stat gathering (method stolen from procps).
- Supports SMP
- Will automatically switch to 'userspace' governor.
- Care taken to make the code non-root exploitable (but please audit for yourself first!)
- Frequency step size is configurable (default to 100MHz/step)
- 4 different behavioral modes to choose from (SINE, AGGRESSIVE, PASSIVE, LEAPS), which determine the behavior when the load changes. Configurable from the command line.
- Written in C for speed and simplicity.
- Logging to stdout or syslog
- Configurable Polling frequency in milliseconds (defaults to 1s)
- Configurable highwater/lowwater marks for CPU usage. (defaults 80/20%)
Installation
Prerequisites
In order for frequency scaling to work properly, you will need to load the appropriate kernel module for your processor. Most modern notebooks and desktops can simply use the acpi-cpufreq module. As of Arch 2009.8, the following four modules are available in the 2.6.30-ARCH kernel:
- acpi-cpufreq: uses ACPI Processor P-States, common to many modern motherboards/CPU’s.
- p4-clockmod: cpufreq driver for older Pentium(TM) 4/Xeon(TM).
- powernow-k8: AMD Athlon 64 and Opteron processor frequency driver.
- speedstep-lib: Library for Intel SpeedStep 1 or 2 cpufreq drivers.
I can verify that the acpi-cpufreq modules works with my Core2Quad Xeon processor as well as on my C2D laptop.
To load the CPU Frequency driver manually:
# modprobe acpi-cpufreq
To load the driver automatically at startup, add the appropriate driver to the MODULES array within /etc/rc.conf. For example:
MODULES=( acpi-cpufreq vboxdrv fuse fglrx iwl3945 ... )
Installation of Powernowd
This package is available from the [powernowd page] in the AUR . If you haven't used the AUR before, you may want to check out AUR_User_Guidelines at your leisure as there are a wealth of great software there for you, and building the package on your machine is trivial.
Download powernowd via the link above or via
$ wget http://aur.archlinux.org/packages/powernowd/powernowd.tar.gz
Now untar, build your package, and install it.
$ tar zxvf powernowd.tar.gz $ cd powernowd $ makepkg -s PKGBUILD
After the package is built, install it with pacman. If you're on x86_64
# pacman -U powernowd-1.00-1-x86_64.pkg.tar.gz
If you're on i686
# pacman -U powernowd-1.00-1-i686.pkg.tar.gz
Start powernowd manually
# /etc/rc.d/powernowd start
To have it automatically load at startup, add powernowd to your daemons array in /etc/rc.conf as you have done for other daemons. For example:
DAEMONS=(@syslog-ng @network netfs crond alsa hal fam powernowd cups gdm...)
Basic Configuration
The only configuration you need is to set the highwater/lowwater marks for CPU usage. Basically this means when the CPU usage is >=highwater mark, then powernowd will use your highest CPU multiplier (i.e. full power); when the CPU usage <=lowwater mark, then powernowd will use your lowest CPU multiplier. The defaults are 80/20% but I find that adjusting them down gives me a more responsive system. I use 15/5% for example. To do so edit your /etc/conf.d/powernowd inserting the following line:
OPTIONS="-q -u 15 -l 5"
Restart the daemon and enjoy
# /etc/rc.d/powernowd restart
There are other options you can set such as modes of operation (sine, passive, aggressive, leaps), polling frequency, humber of threads per core, etc. To see what is available, invoke powernowd with the -h switch
$ powernowd -h PowerNow Daemon v1.00, (c) 2003-2008 John Clemens Daemon to control the speed and voltage of cpus. This is a simple client to the CPUFreq driver, and uses linux kernel v2.5+ sysfs interface. You need a supported cpu, and a kernel that supports sysfs to run this daemon. Available Options: -h Print this help message -d Don't detach from terminal (default is to detach and run in the background) -v Increase output verbosity, can be used more than once. -q Quiet mode, only emergency output. -n Include 'nice'd processes in calculations -m # Modes of operation, can be 0, 1, 2, or 3: 0 = SINE, 1 = AGGRESSIVE (default), 2 = PASSIVE, 3 = LEAPS -s # Frequency step in kHz (default = 100000) -p # Polling frequency in msecs (default = 1000) -c # Specify number of threads per power-managed core -u # CPU usage upper limit percentage [0 .. 100, default 80] -l # CPU usage lower limit percentage [0 .. 100, default 20]