Friday, April 06, 2007

CPU frequency selector

About a year ago I bought a IBM ThinkPad R50e, which is actually one of the most basic IBM laptops you will find. It came with 256 MB RAM (which I upgraded to 512 MB), it has no fancy things like TV-Out and did not come with a integrated WiFi card, and does not have an mini-PCI slot.
But well it came with all the things I really needed, and I bought a nice WiFi PC-Card (about which I will blog soon), and everything works like a charm.
The "luxury" of this laptop is the CPU, it contains an "Intel Pentium M 1.60 GHz processor", which is pretty nice for such a modest laptop. It's a stepping CPU which means in normal mode it will run at 600 MHz and on demand will step up a maximum of 5 steps, 200 MHz each.
Under Microsoft Windows I could use a tool that came from Intel to set the CPU stepping manually, for example if my battery was very low I could force it to run at 600 MHz, so I would get the most time out of it.
In Ubuntu however I could use the CPU frequency tool to read the current frequency but I couldn't adjust it, which can come in handy sometimes. Then Dennis Laumen (my hero in this case) said he read something about why this is not enabled by default. The CPU frequency is a system setting and should not be configurable by any user, only users with administrative permissions, and by default a gnome-panel applet doesn't have these rights. This can however be changed really easy.
  1. Open a terminal window and type "sudo dpkg-reconfigure gnome-applets".
  2. Execute that command and enter the root password to get administrative permissions.
  3. The following dialog will appear, read it and press "OK".

  4. Then you are presented with the question to give the cpufreq-selector tool permission to set the frequency stepping of the CPU, this question should be answered with "Yes".

  5. Wait until control is returned to the terminal and close it.
If I (left)click the CPU frequency monitor gnome panel applet now it looks like.

After this it's time to Rock'n'Roll, thanks to Dennis Laumen for pointing this out to me, and Carlos Garcia Campos for creating this wonderful applet.

  • It would be nice if the frequency selector could be activated using the preferences of the applet, it could then by using gksudo possibly give a graphical interface for users to enter their root password and activate the additional functionality.
  • It's also possible to use governors which will adjust the frequency of the CPU dynamically after certain parameters change, for example the demand of CPU power.


Pascal de Bruijn said...

CPU Stepping is usually used to incidate the CPU's revision number.

So this might confuse folks.

Anonymous said...

In Windows there is also a verry small and helpfull tool were you can set the cpu stepping manually or in dynamic switching mode and this works like a charm. The CPU always runs on 600 mhz but when you need power if you are calculating something it will go up and it is even more energy efficient then "fixing" it on one certain level

lgespee said...

Anonymous, Linux does this by default too, it uses only 600 MHz and on demand will add more.
But I couldn't fix it manually. Sometimes I just want to fix it at 600 MHz or sometimes 1600 MHz manually. Otherwise I will just activate one of the "governors" and let the system do its work like it normally does.

Tony said...

This works fine if you have a single core processor, but I have a dual core processor. I was able to adjust core 1 (cpu 0) but not core 2 (cpu 1)

Anonymous said...

Interesting story you got here. I'd like to read a bit more about that matter. The only thing your blog misses is a few photos of any gadgets.
David Watcerson
Phone Blocker