&160;linux-tux core2extreme_quad_cpu
Cpufreqd is 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.

The nice things with Linux is that you have a total, absolute, full control!

Defining new profiles

Look for cpufreqd.conf

My profile settings are in /etc/sysconfig/powersave

Example of a profile

name=On Demand High

Defining Rules:

Examples of the flexibility offered:

  • If temperature is too high, throttle CPU speed lower
  • if some application are running, lets say your anti-virus, you may want more CPU:

There is a lot more settings, as usual, just read the manual

# man cpufreqd.conf&160;

Querying the CPU

To list all available profile, just run as root

# cpufreqd-get -l


# cpufreq-info

analyzing CPU 0:
&160; driver: powernow-k8
&160; CPUs which need to switch frequency at the same time: 0
&160; hardware limits: 1000 MHz - 2.00 GHz
&160; available frequency steps: 2.00 GHz, 1.80 GHz, 1000 MHz
&160; available cpufreq governors: ondemand, userspace, powersave, performance
&160; current policy: frequency should be within 2.00 GHz and 2.00 GHz.
&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; The governor "ondemand" may decide which speed to use
&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; within this range.
&160; current CPU frequency is 2.00 GHz (asserted by call to hardware).&160;

Changing the CPU speed


Now lets change the speed. As a server, I don't see any reason to try to minimize the speed except in order to save electricity. The profile onDemand should be able to provide the best compromise, changing CPU speed based on server load and thus be more green. For the sake of this article, I will forbid the CPU to downgrade its speed...
Attention you'll have to respect the hardware limit of you processor. In my case I use currently an AMD K8 Opteron 146 rated at maximum 2GHz

So depending on your processor, you'll have to either

  • Query the Internet to find the CPU speed range or
  • Use cpufreqd-info that's for sure the fastest and safest
  • Extracting the info from where they are (for every cpu):
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

I was shocked to discover that my current max speed was set at 1Ghz, leading to a server consuming 80 to 250% of CPU load.

By running, this command cpufreq, I force the system to never go below 2GHz.

cpufrequtils 0.4: cpufreq-set (C) Dominik Brodowski 2004
Report errors and bugs to This email address is being protected from spambots. You need JavaScript enabled to view it., please.
Usage: cpufreq-set [options]
&160; -c CPU, --cpu CPU&160;&160;&160;&160;&160;&160;&160; number of CPU where cpufreq settings shall be modified
&160; -d FREQ, --min FREQ&160;&160;&160;&160;&160; new minimum CPU frequency the governor may select
&160; -u FREQ, --max FREQ&160;&160;&160;&160;&160; new maximum CPU frequency the governor may select
&160; -g GOV, --governor GOV&160;&160; new cpufreq governor
&160; -f FREQ, --freq FREQ&160;&160;&160;&160; specific frequency to be set. Requires userspace
&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; governor to be available and loaded
&160; -h, --help&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Prints out this screen

1. Omitting the -c or --cpu argument is equivalent to setting it to zero
2. The -f FREQ, --freq FREQ parameter cannot be combined with any other parameter
&160;&160; except the -c CPU, --cpu CPU parameter
3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz
&160;&160; by postfixing the value with the wanted unit name, without any space
&160;&160; (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).

# cpufreqd-set -c 0 -d 2GHz

The BogoMips make a jump and also the server load is greatly reduce, this can be confirmed by executing:

# cat /proc/cpuinfo

processor&160;&160;&160;&160;&160;&160; : 0
vendor_id&160;&160;&160;&160;&160;&160; : AuthenticAMD
cpu family&160;&160;&160;&160;&160; : 15
model&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; : 39
model name&160;&160;&160;&160;&160; : AMD Opteron(tm) Processor 146
stepping&160;&160;&160;&160;&160;&160;&160; : 1
cpu MHz&160;&160;&160;&160;&160;&160;&160;&160; : 1995.468
cache size&160;&160;&160;&160;&160; : 1024 KB
fdiv_bug&160;&160;&160;&160;&160;&160;&160; : no
hlt_bug&160;&160;&160;&160;&160;&160;&160;&160; : no
f00f_bug&160;&160;&160;&160;&160;&160;&160; : no
coma_bug&160;&160;&160;&160;&160;&160;&160; : no
fpu&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; : yes
fpu_exception&160;&160; : yes
cpuid level&160;&160;&160;&160; : 1
wp&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; : yes
flags&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov
&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext
&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; fxsr_opt lm 3dnowext 3dnow pni lahf_lm
bogomips&160;&160;&160;&160;&160;&160;&160; : 3994.29

Back to my Linux desktop

I really enjoy using OpenSuse 11.1 powered by KDE 4.2, changing CPU settings has never been easier thanks to the applet KPowersave

KPowersave is the KDE front end for power management. It provides battery monitoring, suspend/ standby triggers and many more power management features for KDE (and GNOME).

You'll find the same applet in all version of KDE

powersave KPowersave is great ad very intuitive in KDE 4.2
comments powered by Disqus

You might like also

Oracle ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
The Oracle error ORA-00054 can be solved by executing as DBA the following query select p.spid,s.sid,s.serial#,s.username,s.status,s.last_call_et, p.program,p.terminal,logon_time,module,s.osuser from V$process p,V$session s where s.paddr = p.addr and s.status = &39;ACTIVE&39; and s.username not like &39;%SYS%&39;; This will return the PID of the hanging process You can then SSH to the server ruining oracle and kill the process kill -9 PID …
1968 Days ago
Oracle ORA-00054: resource busy and acquire with NOWAIT specified
ORA-00054: resource busy and acquire with NOWAIT specified Cause: Resource interested is busy. Action: Retry if necessary. I show you here how to get around this error and kill the sessions that are preventing the exclusive lock. Note that you could also (preferred) Run your changes later when the database is idle. Do all DDL during a maintenance window when all users are not logged in …
2151 Days ago
Oracle Please set ORACLE_UNQNAME to database unique name
if you encounter this error while starting oracle /etc/init.d/oraemctl start Starting Oracle EM DB Console: Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name. OK One possible solution is to edit the script # vi /etc/init.d/oraemctl and add the following code in blue …
2478 Days ago
Install XEN Server without an Optical Drive
Citrix XenServer is a complete, managed server virtualization platform built on the powerful Xen hypervisor. Xen technology is widely acknowledged as the fastest and most secure virtualization software in the industry. In case you don’t have any optical drive attached to the server, this small how to will help you to install Xen Server as domain 0 (dom0) using USB flash drive. Download XEN server iso from http://www.citrix.com/English/ss/downloads/index.asp Format your USB drive using FAT32, Use an older version of UNetbootin …
2672 Days ago
Map Synology network drive under linux
How to mount your Synology NAS (or any other NAS brand) shared folder under Linux using CIFS. CIFS stands for "Common Internet File System," also known under the older name SMB (Server Message Block),  which is a network protocol used by Windows clients for issuing file access requests to Windows servers Open a terminal and as root, create as many directory as needed in /mnt/ # sudo mkdir /mnt/video # sudo mkdir /mnt/music Unfortunately there is no frontend or editor …
3105 Days ago
Advanced Oracle Weblogic start/stop script
The Oracle WebLogic 11g application server product line is the industry's most comprehensive Java platform for developing, deploying, and integrating enterprise applications. It provides the foundation for application grid, which is an architecture that enables enterprises to outperform their competitors while minimizing operational costs. …
3107 Days ago
Basic operations with XEN server: export, import of VM templates and guests
More and more I am using XEN at work, and here is a small how to of some very common operations. Citrix® XenServer® is a complete, managed server virtualization platform built on the powerful Xen® hypervisor. Xen technology is widely acknowledged as the fastest and most secure virtualization software in the industry. XenServer is designed for efficient management of Windows® and Linux® virtual servers and delivers cost-effective server consolidation and business continuity. By the way if you succeed installing XEN …
3107 Days ago
Debian Lenny how to
  Short description of how to accomplish some specific task in Debian Lenny. How to install Sun java 1.6 on Debian Lenny How to install Tomcat 6.x on Debian Lenny How to install MySQL on Debian Lenny             …
3437 Days ago
Some useful Unix/Linux Bash alias
Some useful Bash Linux alias taken from my user profile. If you have a long command that you type frequently consider putting it in as an alias. In computing, alias is a command in various command line interpreters (shells) such as Unix shells, 4DOS/4NT and Windows PowerShell, which enables a replacement of a word with another string. It is mainly used for abbreviating a system command, or for adding default arguments to a regularly used command. [WikiPedia] …
3503 Days ago
Useful Unix/Linux bash functions
For day to day hacker, they may be more elegant ways to do it (PERL, AWK), but they have work well for me. Upper case file name or variable, Search and replace in all files content recursively, Renaming all files recursively, Renaming all directory recursively, Copying a set of files from one directory to the other and preserving hierarchy. …
3503 Days ago