Saturday, 11 July 2009

Power Consumption During Hibernation

When a Linux laptop or netbook is hibernated you would assume that it's not drawing any power from the battery and so it can be left hibernated for months. Well, that's not strictly true!

Firstly, one has to consider the fact that laptops and netbooks have an embedded controller inside that consume a slight amount of power. Also, for some reason, some machines may flash a LED periodically to show that the machine is hibernated, this too draws a very small amount of power.

One can measure the amount of power being used during hibernation using the following recipe:

First, we need to measure the power used to just hibernate:

1. firstly charge up your laptop battery and then unplug the power plug,
2. measure the battery capacity. I have a simple script to do this,
3. hibernate the machine and then immediately resume it,
4. measure the battery again,
5. subtract the measurement in step 2 from the measurement in step 4. This is the amount of power used to do a hibernate cycle (e.g. power used to write memory to disc, and the reverse on wake up).

Next, we need to measure the amount of power used for a LONG hibernate:

6. measure the battery capacity again.
7. hibernate the machine for more than 30 minutes, e.g. for 1 hour is good, and then wake it up.
8. measure the battery once more. Subtract the figure from step 6 away, and also the figure derived in step 5 away and you then have the amount of power consumed just to do the long hibernate.

I've hacked up a script to do this automatically - it's still work in progress through, it may not work on some machines because the ACPI alarm may not be 100% reliable.

You may be surprised how much power is being used to do nothing!

So what's consuming all this power? Well, some of the power loss could be due to battery leakage - older batteries seem to suffer more than newer ones, but this cannot be the full story. From my tests the power consumption can be due to:

1. Battery leakage. Varies depending on battery age and type.
2. The Embedded Controller just being busy and flashing LEDs etc.
3. Devices not being fully turned off, e.g. Wifi, Bluetooth etc.
4. Others - probably poor laptop design(?)

Hopefully drivers will improve to fix issue 3 and Intel power management in general should improve over time too. Indentifying the bad drivers is the next step in my quest, but don't hold ones breath - there is a lot of code and the information on a lot of hardware is closed, so figuring out how to make it more power efficient is not straight forward!

I also believe the ACPI wake alarm can also suck a little power. This can be used to wake the machine up at some predetermined time in the future, for example MythTV boxes used this feature to wake up a PC to start recording TV. Turning off the alarm probably saves a little amount of power, one trick is to program it to trigger in the next second or so, and then hibernate the machine.

Any other ideas on exactly where all that power is going would be appreciated!

Meanwhile, just don't assume hibernation is totally power friendly :-)

No comments:

Post a Comment