RSS



CPU Scaling, Ubuntu, battery life and you – how to scale your CPU

Wed, Jan 16, 2008

ArsGeek, Linux, Technology, Ubuntu, howto

Talk about it in our Forums

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.

cpufreq1.png

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

cpuscale2.png

cpuscaling3.pngThis 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.

cpuscaling4.png

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: , , , , , , ,

Popularity: 7% [?]

Share and Enjoy:
  • Digg
  • del.icio.us
  • MisterWong
  • Reddit
  • Technorati
  • BlinkList
  • Facebook
  • Fark
  • Mixx
  • Slashdot

This post was written by:

arsgeek - who has written 1989 posts on ArsGeek.


Contact the author

49 Comments For This Post

  1. Nicolas Says:

    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.

  2. zsolt320i Says:

    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.

  3. Bjørnar Says:

    Thanks for this information :D

  4. Kareem Alexandre Says:

    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!

  5. tech gadget Says:

    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 :) .

  6. Fletcher Mcpharlane Says:

    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.

  7. Wedding centerpiece vases Says:

    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.

  8. Wedding centerpiece vases Says:

    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.

  9. Green screen backgrounds Says:

    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.

  10. Positive pregnancy test Says:

    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.

  11. Wooden fence panels Says:

    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.

  12. Toy hauler trailers Says:

    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.

  13. Motorcycle tank bags Says:

    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.

  14. FG Says:

    Very nice. Thanks for the post.
    FYI, it appears that in Ubuntu 10.04 the applet -by default- can manage CPU freq and mode.

  15. key ödemeleri sorgulama Says:

    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.

  16. Pole barn prices Says:

    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!

  17. Prank call voices Says:

    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.

  18. business opportunity review Says:

    I do a hell of a lot of work on trains so this is a great tutorial for me. Thanks dude!

  19. Privacy fence designs Says:

    Essentially, the post is actually the largest worthw hile on this topic. I fit their conclusions and thirsty waiting for their future upgrades.

  20. öss tercih sonuçlar? Says:

    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.

  21. Wall unit furniture Says:

    Well, I was searching on Google for some videos and songs from my favorite singers and just came across your blog, in general, I just visited my blog and retrieve required information, but this time he sent useful information in this post forced me to respond here and thanks for your good work. I bookmarked your blog.

  22. Cretan olive diet Says:

    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. Thank you for taking the time to write this blog post. Much appreciated, very valuable information.

  23. Types of turtles Says:

    Vielen Dank für diese Informationen This blog shows you some of the top tips and information on how to go about SEO, link building, articles and search engine news.

  24. Jayson Domanski Says:

    Hay Friend , i read w/ u idea. Do you have twitter or facebook so i can follow you ?

  25. wall mount TV Says:

    Well, I am so excited that I have found this your post because I have been searching for some information about it almost three hours. You helped me a lot indeed and reading this your article I have found many new and useful information about this subject.

  26. Calories in food Says:

    Substantially, the post is really the greatest on this topic worthw hile. I fit in with your conclusions and will thirstily look forward to your future updates. Saying thanks just will not be sufficient, for the fantastic c lucidity in your writing. I will instantly grave your rss feed to stay privy of any updates. Gratifying work and much success in your business dealings! There is no tolerance for doing the same mistake over and over again. They would better take off the hands and say sorry, lol

  27. Hacking tricks Says:

    thkss forr this kind of info now i can work on my laptop longer….keep writing such kind of post

  28. Pacquiao Margarito Fight Video Says:

    ll the contents you mentioned in post is too good and can be very useful. I will keep it in mind. Thanks for sharing the information. Keep updating, looking forward for more posts. Thanks.

  29. New bridesmaid dress patterns Says:

    Very nice redesign gives me a lot of inspiration being right in the Midst of a. It’s all in the details and comment forms are definitely overlooked more often than not. Time well spent on this post Hey I object your name I instrument agree for your insert please prepare bill!

  30. Motorcycle hitch carrier ideas Says:

    Saying thanks not only be sufficient for exceptional clarity in his writing. I instantly grab your RSS feed to keep abreast of any updates. This is my first time i visit here. I found so many entertaining 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 wor

  31. Homemade pregnancy test ideas Says:

    Substantially, the post is really the greatest on this topic worthw hile. I fit in with your conclusions and will thirstily look forward to your future updates. There ought to be one day – just one – when there is open season on senators.

  32. Appetizers for a crowd ideas Says:

    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. Cool! That just makes sense for many’s minds, lol. We should be more optimistic in life.

  33. Toshiko Delore Says:

    However yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love studying more on this topic. If doable, as you grow to be experience, would you mind updating your weblog with more details? It is extremely helpful for me. Huge thumb up for this blog publish!

  34. landscaping Says:

    wiadomosci blog tresci zwrot podatku newsy blog informacje blog przeczytaj wiadomosci dla ciebie aktualnosci nowosci naklejki scienne sprawdz to wiadomosci

  35. Birthday ideas for boyfriends Says:

    Saying thanks not only be sufficient for the lucidity c Fantasti in their writing. I instantly grab your RSS feed to keep abreast of any updates. Thanks for the info on the link. I recently came across your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog.

  36. Cheap snapback hats Says:

    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. With the new day comes new strength and new thoughts.

  37. androidfan Says:

    Thanks alot this explained alot even though I’m trying to oc my phone, it helped me understand. What different settings meant because alot of people haven’t defined stuff and expect u to know

  38. koop viagra Says:

    Oh man i like your blog!

  39. erectie Says:

    I am a fan of this blog!!.

  40. Hacking Tricks and tips Says:

    Am an avid ubuntu user, and this tips is gonna help alot. thanks for sharing

  41. mortgage calculator Says:

    This morning we are featuring Pluristem Therapeutics Inc.

  42. Garnet Holberton Says:

    You will find absolutely a lot of more details to take into consideration

  43. Business Directory Listing Says:

    This can save energy and battery life and performance at the expense of a bit – which is ideal for extending the life of your laptop when offline.

  44. music production Says:

    I try to learn something new on different blogs regularly. It is always refreshing to read posts of other blogger and learn something from them.

  45. austin cosmetic dentist Says:

    There is lot of information and they are very innovative and informative.

  46. essays term papers Says:

    It is so lucky to read your blog; it is full of useful message. I wish we both can do better in the future. It great honor if you can visit our website, and give us some suggestion.

  47. nope Says:

    none of this worked. im in ubuntu 11.10 but right click the bar at the top does nothing. I have no applets what do i do?

  48. Corporate Fashion Says:

    You are awesome! This blog is so great. I really hope more people read this and get what you’re saying, because let me tell you, its important stuff. I never would’ve thought about it this way unless Id runs into your blog. Thanks for putting it up. I hope you have great success.

  49. Innovative Web Provider Says:

    Thanks for this! I’m gonna apply this one right after I install ubuntu on my laptop. Nice Post by the way.

3 Trackbacks For This Post

  1. Scale your CPU « 0ddn1x: tricks with *nix Says:

    [...] Scale your CPU Filed under: Linux — 0ddn1x @ 2008-01-24 19:54:16 +0000 http://www.arsgeek.com/?p=3344 [...]

  2. Eiriks forfatterblogg :: The Awful Truth: power history of a T61 with Ubuntu 8.04 Says:

    [...] The screendump above shows the power history of my T61 for the two hours and fifteen minutes a full charge lasts. The variation is due to a mixture of writing, watching a movie (that’s the peak around 42 minutes) and talking to a fellow passenger (that’s the trough near the two hour mark). The screen brightness was between the minimum setting and 50 %. Both radio transmitters were switched off, which saves about 3 W. I am also running Powertop and CPU Scaling. [...]

  3. Eric Garrido » Things I found useful today Says:

    [...] This post on CPU scaling reminded me how to root-enable some CPU tools to allow me to easily scale my processor speeds [...]

Leave a Reply