# Load and Clock Speed vs Power Consumption

What takes less power? Running the CPU at a low clock and having a high load or running it at a high clock speed and having a low load?

• Surely the simplest way to answer the question is to carry out the experiment and then report your results?
– joan
Sep 1, 2015 at 8:05
• This is fundamentaly against the meaning of asking a question :D But yes, I'll try. Sep 1, 2015 at 8:06

It depends!

When I do run a CPU intensive job on all 4 cores of the RPi2 (so each core is 100% busy and not blocked by IOs), I use 645mA @900MHz and 540mA @600MHz. Power consumption is 440mA @600MHz and 450mA @900MHz when idle.

Now for such a workload which is entirely CPU bound, the 50% increase in frequency (and let's consider the simple case where everything is in cache so that we can consider this roughly as a similar increase in computational speed), but only roughly 20% more power is used. Now let's assume our work load was lasting 1 hour @600MHz, so that @900MHz it is 50% faster, it means, it takes only 30minutes to complete. Now in terms of power, @600MHz you consumed 540mAh whereas you only consumed 373mAh @900MHz. So in this highly hypothetical case, you saved power by increasing the frequency.

If you have the same workload but @600MHz that last 30 minutes but then 30 minutes nothing. In 1 hour you can only do 1 computation and you consumed: 270+220=490mAh. @900MHz you can manage to do 2 computations and you consumed: 373+225=598mAh. So you consumed more, but you did twice as much!

If now you have some activities, but they involve reading or writing from and to IOs (e.g. SD card, network, GPIOs, etc.), these will be blocking more or less your CPU during times, so you don't necessary get a better speed improvement when you increase the frequency, because you are mostly IO bound. And if you have too many IOs, then increase the frequency might not change much your overall application performance. In this case, it is rather difficult to compute any power consumption, because the IOs are also consuming some extra energy.

The best is to use a CPU scheduler (or governor) that is dynamic and able to increase the frequency when it is needed (so your computation gets faster) and decrease it as soon as not needed. Check what's your scheduler with this command:

``````cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
``````

The return value is probably one of: conservative, ondemand, userspace, powersave, performance.

If you want to follow my recommendation, choose "ondemand". If you want max frequency (no scaling), choose "performance". If you lowest frequency (no scaling), choose "powersave". Here I choose for cpu0 the ondemand governor:

``````sudo bash -c "echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
``````