How to control CPU frequency?

When CPUs run in full throttle for certain amount of time, temperature of CPUs increase gradually until it shuts down the system for destroying itself.

My Linux desktop has AMD Athlon(tm) 64 X2 Dual Core Processor 4800+. It’s operating temperature is 49°C – 65°C. Few days ago while I was encoding video file, the temperature went up to 120°C at 2.5 GHz. And suddenly the CPU shut down.

To find CPU information, do ‘cat /proc/cpuinfo’.

Limiting CPU frequency is another way of control temperature without investing money for cooling device. I set maximum frequency of the CPU at 2.0 GHz which is eighty percent of 2.5 GHz.

cpufreq-info will show available CPU frequency ranges like below.
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: powernow-k8
CPUs which run at the same hardware frequency: 0 1
CPUs which need to have their frequency coordinated by software: 0 1
maximum transition latency: 109 us.
hardware limits: 1000 MHz - 2.50 GHz
available frequency steps: 2.50 GHz, 2.40 GHz, 2.20 GHz, 2.00 GHz, 1.80 GHz, 1000 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 1000 MHz and 2.50 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 1000 MHz.
cpufreq stats: 2.50 GHz:1.62%, 2.40 GHz:0.13%, 2.20 GHz:0.12%, 2.00 GHz:0.09%, 1.80 GHz:0.56%, 1000 MHz:97.48% (3995)
analyzing CPU 1:
driver: powernow-k8
CPUs which run at the same hardware frequency: 0 1
CPUs which need to have their frequency coordinated by software: 0 1
maximum transition latency: 109 us.
hardware limits: 1000 MHz - 2.50 GHz
available frequency steps: 2.50 GHz, 2.40 GHz, 2.20 GHz, 2.00 GHz, 1.80 GHz, 1000 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 1000 MHz and 2.50 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 1000 MHz.
cpufreq stats: 2.50 GHz:1.62%, 2.40 GHz:0.13%, 2.20 GHz:0.12%, 2.00 GHz:0.09%, 1.80 GHz:0.56%, 1000 MHz:97.48% (3995)

Use cpufreq-set to set maximum freqency. Here is what I did.
$ cpufreq-set -u 2.0Ghz

To set it permanently, type the following command.
Source
cpufreq-set -d [freq] && cpufreq-set -u [freq] && cpufreq-set -g userspace

(8/10/2012;)
For running cpufreq-set at boot time

I edited /etc/init.d/cpufrequtils file as below:
Set the minimum frequency to 1.0GHz (1000000), maximum one to 2.0 GHz (2000000).

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
# 2500000 2400000 2200000 2000000 1800000 1000000

ENABLE="true"
# ondemand
GOVERNOR="powersave"
MAX_SPEED=2200000
MIN_SPEED=1000000

Did test run to check it.
$ sudo ./cpufrequtils start
[ ok ] CPUFreq Utilities: Setting ondemand CPUFreq governor...CPU0...CPU1...done.

Added it to the boot up script files

$ sudo update-rc.d cpufrequtils defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match cpufrequtils Default-Stop values (none)

/etc/rc2.d directory has the symbolic link file.
lrwxrwxrwx 1 root root 22 Aug 10 17:58 S17cpufrequtils -> ../init.d/cpufrequtils

About these ads

About janpenguin

Free Energy technologies, Permaculture Email: janpenguin [at] riseup [dot] net Every content on the blog is made by Free and Open Source Software in Debian GNU/Linux.
This entry was posted in GNU/Linux and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s