cpufreq utility

cpufrequtils is package which has two nice tools very useful for laptop users.

cpufreq-info is a nice command, which will give information about the cpu.
Here is what I get on my laptop

——————————————————————————————————
rhlaptop:/home/ram#cpufreq-info
cpufrequtils 004: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to cpufreq@lists.linux.org.uk, please.
analyzing CPU 0:
driver: acpi-cpufreq
CPUs which need to switch frequency at the same time: 0 1
hardware limits: 1000 MHz – 2.00 GHz
available frequency steps: 2.00 GHz, 1.67 GHz, 1.33 GHz, 1000 MHz
available cpufreq governors: conservative, powersave, ondemand, userspace, performance
current policy: frequency should be within 1000 MHz and 2.00 GHz.
The governor “performance” may decide which speed to use
within this range.
current CPU frequency is 2.00 GHz (asserted by call to hardware).
cpufreq stats: 2.00 GHz:100.00%, 1.67 GHz:0.00%, 1.33 GHz:0.00%, 1000 MHz:0.00%analyzing CPU 1:
driver: acpi-cpufreq
CPUs which need to switch frequency at the same time: 0 1
hardware limits: 1000 MHz – 2.00 GHz
available frequency steps: 2.00 GHz, 1.67 GHz, 1.33 GHz, 1000 MHz
available cpufreq governors: conservative, powersave, ondemand, userspace, performance
current policy: frequency should be within 1000 MHz and 2.00 GHz.
The governor “performance” may decide which speed to use
within this range.
current CPU frequency is 2.00 GHz (asserted by call to hardware).
cpufreq stats: 2.00 GHz:100.00%, 1.67 GHz:0.00%, 1.33 GHz:0.00%, 1000 MHz:0.00%
——————————————————————————————————————-

This is a detailed output. There are specific options like -f to give frequency, -p for policy etc.
Of importance to us is the policy.
rhlaptop:/home/ram# cpufreq-info -p
1000000 2000000 performance
This means my cpu is tuned for high performance which may mean more power consumption. When on battery it is better to trade off performance with battery life. Different governors are available to help us. They are
——————————————————————————————————————
rhlaptop:/home/ram# cpufreq-info -g
conservative powersave ondemand userspace performance
——————————————————————————————————————
As you can see above we can choose what is appropriate to us.
This tool has another command called cpufreq-set. Using this we can set various cpu options. e.g
cpufreq-set -p powersave
will set cpu to powersave mode reducing frequency of CPU.
I did a small test to understand the significance of cpu frequency. I used acpi command to give batterlife
I ran this script in a terminal
(it is a quick shell script – not perfect or very efficient)
freq=’performance’
while true
do
sleep 60
cpufreq-info -p
acpi
if [ $freq = “performance” ]
then
cpufreq-set -g powersave
freq=’powersave’
else
cpufreq-set -g performance
freq=’performance’
fi
done

Then I continued with my normal usage, including running some youtube videos.
Here is the output

1000000 2000000 performance
Battery 0: Discharging, 92%, 02:24:31 remaining, design capacity 4353 mAh
1000000 2000000 powersave
Battery 0: Discharging, 92%, 03:02:38 remaining, design capacity 4353 mAh
1000000 2000000 performance
Battery 0: Discharging, 91%, 02:52:27 remaining, design capacity 4353 mAh
1000000 2000000 powersave
Battery 0: Discharging, 91%, 03:08:29 remaining, design capacity 4353 mAh
1000000 2000000 performance
Battery 0: Discharging, 90%, 03:06:58 remaining, design capacity 4353 mAh
1000000 2000000 powersave
Battery 0: Discharging, 90%, 03:06:58 remaining, design capacity 4353 mAh
1000000 2000000 performance
Battery 0: Discharging, 89%, 03:03:17 remaining, design capacity 4353 mAh
1000000 2000000 powersave
Battery 0: Discharging, 89%, 03:03:17 remaining, design capacity 4353 mAh
1000000 2000000 performance
Battery 0: Discharging, 88%, 03:02:04 remaining, design capacity 4353 mAh
1000000 2000000 powersave
Battery 0: Discharging, 88%, 03:02:04 remaining, design capacity 4353 mAh
1000000 2000000 performance
Battery 0: Discharging, 87%, 02:44:15 remaining, design capacity 4353 mAh
1000000 2000000 powersave
Battery 0: Discharging, 87%, 02:56:33 remaining, design capacity 4353 mAh
1000000 2000000 performance
Battery 0: Discharging, 86%, 02:33:21 remaining, design capacity 4353 mAh
1000000 2000000 powersave
Battery 0: Discharging, 86%, 03:00:57 remaining, design capacity 4353 mAh
————————————————————————-
Notice that the difference in battery life is marginal when load is small.

Running cpu at lower speed didn’t have any perceptible change in my normal working environment.

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

%d bloggers like this: