Tuesday, 26 July 2011

Extend laptop battery life with CPU scaling

If you have a laptop with poor battery life, it is really annoying to have it run out when you're doing something important like word processing. Many computers support CPU scaling however, which is a way of making your processor use less power.

(Note that this post might look a bit intense, but it really isn't, it just has a few terminal commands)

The first step of this is to see what modes your CPU can use, so type
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
in a terminal. You should see a range of options, if not your CPU may not support scaling. My options are: "conservative ondemand userspace powersave performance".

At this point you should check the default for your CPU with:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
this will tell you which mode your computer is currently using so you can switch back to it later.

You can then tell your computer to use a certain mode on the CPU. If you're just taking notes at work you probably need no more than powersave (or your CPU's equivalent).
cpufreq-selector -c 0 -g powersave
Note that you must put your core number after the -c. If your CPU has a dual-core processor (2 cores), run this twice with "-c 0" and "-c 1" (and do the appropriate for triple/quad cores).

And that's it! You can check how your CPU is doing with
cat /proc/cpuinfo | grep "cpu MHz"
Try comparing it with performance mode to see the difference.

1 comment:

  1. It is a great thing ,but I still cannot change the CPU freq. even though it says power-save after checking the freq I sill get 2400mgh which is the max.
    Could you help me I am running amd v160 2.4 on prsario cq56