As you're probably aware, modern CPU's run at a variable clock frequency in order to save power when the machine isn't too busy. My workstation for example runs at 800MHz by default and independently spins cores up to 3.2GHz on demand when more performance is required.

Just to put that into context, when idle the CPU draws around 50w, and when running on all six cores at full-tilt, it draws around 130w. So if you leave your machine running, that would be 0.05 KHW vs 0.13 KWH. Now if you reckon a KWH is around 10p. that's 12p per day vs 31p per day, which is £43 per year as opposed to £113 per year, so minimising your CPU burn is worth around £70 per year. (and of course if you're me, that per machine)

Whereas all those numbers may not be entirely accurate, and while turning up the clock speed to a maximum doesn't necessarily use the entire 130w, there's certainly a few free Pizza's per year in there somewhere. So, try this on for size;

#!/bin/bash
if [ $1 ] ;
then
  for i in 0 1 2 3 4 5 do
    echo $1 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
  done
fi
cat /proc/cpuinfo|grep MHz

I usually stick this in /usr/local/bin/performance followed by a chmod a+x. What does it do? well, type in performance and it'll tell you how much juice you're using, or type in an additional keyword and it'll turn the juice up or down. In particular the kernel recognises performance as a keyword for turn it all the way up and ondemand to dynamically adjust the speed as required. For example;

$ performance
cpu MHz		: 800.000
cpu MHz		: 800.000
cpu MHz		: 800.000
cpu MHz		: 800.000
cpu MHz		: 800.000
cpu MHz		: 800.000

Ok, so I'm just typing and this is what ondemand looks like.
Now we'll tell it to use everything;

$ sudo performance performance
cpu MHz		: 3200.000
cpu MHz		: 3200.000
cpu MHz		: 3200.000
cpu MHz		: 3200.000
cpu MHz		: 3200.000
cpu MHz		: 3200.000

So it changed the clock speed, then told you the new speed.
Now we stick is back on ondemand;

$ sudo performance ondemand
cpu MHz		: 3200.000
cpu MHz		: 1600.000
cpu MHz		: 800.000
cpu MHz		: 1600.000
cpu MHz		: 800.000
cpu MHz		: 2400.000

Ok, so this time I had a few additional jobs running in the background. Generally I leave my machine in ondemand mode and this copes fine, however if I'm doing something a little more performance intensive (like playing a game or running a big compile) I might hike it up.

You should find your machine in ondemand mode by default, but you can set it explicitly fairly easily by adding the following to /etc/rc.local somewhere before the exit line.

/usr/local/bin/performance ondemand

If you do find this saves you a few pizza's a year, then you're more than welcome to send me some Pizza Hut tokens ... :-)