CPU Scaling is a feature built into most modern (mobile) CPUs that allows them to scale up or down in how fast they run and how much energy they suck down based on demand. If you have a fairly modern mobile computer there’s a very good chance that your CPU(s) can handle frequency scaling.
Why should you care? Well, you can control this to tell you computer how much power and how fast it should allow it’s CPU(s) to operate. This can save some energy and thus battery life at the expense of a little performance – which is great for extending the use time of your laptop when it’s unplugged.
Can your CPU(s) handle scaling? There’s an easy way to find out. Open up a terminal session (Applications -> Accessories ->Terminal) and type or paste the following into it:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
On my machine I get back
1667000 1333000 1000000
Those are in Hertz, so my machine is capable of 1.66Ghz, 1.33Ghz and 1.00 Ghz.
Now that you know your CPU(s) can handle scaling, let’s see what modes are available. In the terminal, type or paste:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
Again, I get:
powersave ondemand userspace conservative performance
Powersave will keep the CPU constantly at the lowest frequency. Ondemand will set the CPU at the lowest frequency (in my case, 1.00Ghz) until use of the CPU increases, then it will automatically bump it up to the highest frequency (with me, 1.66Ghz). Userspace means that a different program will be used to control the CPU’s scaling. Conservative is where your CPU will go up as needed, starting at the lowest frequency, and then bumping up to the next available until it maxes out. Performance simply sets the CPU(s) at the highest available frequency and keeps it there.
The lower your frequency, the less power you use. So, if you’re bent on extending your battery life to the max, you’d want to keep your CPU(s) at their lowest frequency – but you’ll do this at the expense of computing power. In my case my 1.66Ghz processors would effectively be 1.00Ghz processors.
Now, how do you actively control this? It’s fairly easy. Right click on an empty space in your taskbar (where your applets and such things as Applications, Places and System are located) and choose “Add to panel”. From there, find the CPU Frequency Scaling Monitor. Double click on this and it will appear in your taskbar. Right click on it and choose Properties and you can set various options like have it show your CPU frequency as a frequency (i.e. 1.33Ghz) or as a percentage. If you have multiple CPU’s or a dual/quad core machine you can also choose which CPU to monitor.
To configure this applet to actually allow you to control how your CPU(s) scale, you’ll have to had back to the terminal.
Type this:
sudo dpkg-reconfigure gnome-applets
This will throw up a nifty blue screen asking you to say Yes. Do so. Then it will ask if you want to install cpufreq-selector with SUID root. Say yes. Once you’ve done this, go back to your CPU Frequency Scaling Monitor in your taskbar and left click it. You should now be presented with a bunch of options from which you can choose the one you want. You can also directly set the frequency at which your CPU(s) will run at, which can be handy if you want to scale up or down for a short bit and then manually change it again.
As you can see, I’ve got mine set to Ondemand, allowing the frequency to scale up through three different settings (1 GHz, 1.33 GHz or 1.66 GHz) as needed.
While this will take effect immediately, it will only be in effect until you reboot at which time your default settings will come back. To change the default head back into your terminal and type:
gconf-editor
From there head to apps -> gnome-power-manager -> cpufreq. Find the settings policy_ac and policy_battery and change them to whichever setting you want for the default.
For those with multiple cores or processors who happen to be a bit needy in the info department (like myself) you can add an applet for each CPU. Just add as many applets as you have CPUs and then right click on them, choose Preferences and use the drop down to choose which CPU that particular applet is monitoring.
Now you know a lot more about CPU Frequency Scaling then you may have when you started reading this article and you know how to set it on your computer.
With kudos to thebert and the Ubuntu forums.
Technorati Tags: ubuntu, cpu frequency scaling, howto, linux, mobile, laptops, power saving, battery life


















January 17th, 2008 at 10:27 am
Thanks for the article! By the way, Intel as officially stated before that keeping the governor as “on demand” is the most efficient way to use the CPU while reducing the power consumption.
March 18th, 2008 at 1:06 pm
Hi,
i have Amd Athlon 64 3000, and I got the message that my CPU can not be scaled.
Is it true?
As I know this CPU-s are scalable.
July 5th, 2009 at 5:38 pm
Thanks for this information
December 12th, 2009 at 10:43 am
Substantially, the post is really the greatest on this worthw hile topic. I fit in with your conclusions and will thirstily look forward to your future updates. Saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. Gratifying work and much success in your business dealings!
February 15th, 2010 at 4:37 am
Well I was just searching on Google for some videos and songs of my favorite singers and just came across your blog, generally I just visit blogs and retrieve my required information but this time the useful information that you posted in this post compelled me to reply here and appreciate your good work. I just bookmarked your blog :).
April 6th, 2010 at 11:19 pm
Very nice, gives me a lot of inspiration being right in the midst of a redesign. It’s all in the details and comment forms are definitely overlooked more often than not. Time well spent on this post.
May 3rd, 2010 at 3:44 pm
Saying thanks will not just be sufficient, for the fantastic lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates.
May 8th, 2010 at 4:06 pm
Substantially, the post is really the greatest on this worthw hile topic. I fit in with your conclusions and will thirstily look forward to your future updates.
May 13th, 2010 at 6:14 am
I found so many interesting stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! Keep up the excellent work.
May 16th, 2010 at 2:02 pm
Substantially, the post is really the greatest on this worthw hile topic. I fit in with your conclusions and will thirstily look forward to your future updates. Good quality content is important but it’s not everything. I’ve seen blogs with bad content, yet they still manage to rank on top for several keywords. Sure, they will certainly bore the reader with bad content.
May 16th, 2010 at 2:23 pm
By the way, Intel as officially stated before that keeping the governor as “on demand” is the most efficient way to use the CPU while reducing the power consumption. Just wanna say thank you for the information that you have been shared on your site. Simple but very informative. Hoping that you could give more other information about this.
May 28th, 2010 at 12:32 pm
Saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. Thanks for the information on linking.
May 30th, 2010 at 4:43 pm
Thanks for the article! Indeed, as Intel has officially said that keeping the governor as “on demand” is the most efficient way to use the CPU while reducing energy consumption.
June 11th, 2010 at 9:04 pm
Very nice. Thanks for the post.
FYI, it appears that in Ubuntu 10.04 the applet -by default- can manage CPU freq and mode.
June 30th, 2010 at 8:09 am
I found so many interesting stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! Keep up the excellent work.
June 30th, 2010 at 4:53 pm
Essentially, the post is actually the largest worthw hile on this topic. I fit their conclusions and thirsty waiting for their future upgrades. Saying thanks not only be enough for fantasti c lucidity in his writing. She immediately takes the RSS feed to keep abreast of any updates. Rewarding work and much success in your business relationships!
July 2nd, 2010 at 6:33 am
I found so many interesting stuff in your blog, especially its discussion. I fit their conclusions and thirsty waiting for their future upgrades. Saying thanks not only be enough for fantasti c lucidity in his writing. She immediately takes the RSS feed to keep abreast of any updates.
July 9th, 2010 at 7:17 am
I do a hell of a lot of work on trains so this is a great tutorial for me. Thanks dude!