Measuring power consumption on low power devices really is not as simple as running tools such as PowerTop and then assuming the data is trustworthy. I shall explain why.
With Ubuntu on the Nexus 7, the battery driver originally provided battery capacity in terms of percentage full, which lacked precision to make any sane power consumption estimates. We tweaked the battery driver so that we could get battery capacity in terms of uWh from the bq27541 battery fuel gauge. From this, one can measure the change in capacity over time and estimate the power consumed by the device.
For the Ubuntu 12.04 Precise release I wrote the lightweight power measurement tool "powerstat" to try to determine power consumption using the change in battery capacity. Powerstat can gather changes in the battery capacity level and by using a simple sliding window on the samples it gives an estimate on the power being consumed over time. With laptops that consume a lot of power this provides a reasonable rough estimate of power consumption.
The tweak to the Nexus 7 battery driver allows powerstat to work on the Nexus 7 running Ubuntu. So how trustworthy is the battery data from the battery fuel gauge? Is the data reliable if we repeat the test under the same conditions? Do we get consistent readings over time?
For my first set of tests, I fully charged the Nexus 7 and then fully loaded the 4 CPUs with busy loops and then ran multiple powerstat tests; powerstat gathers samples over 8 minutes and estimates power consumption. It also calculates the standard deviation from these samples to give us some idea of the variability of the battery power measurements. For each powerstat test I logged the battery voltage level, the % battery capacity (normalized to a range of 0..1 to make it easier to plot), the estimated power consumption (with its standard deviation) and then plotted the results:
I also measured an idle machine:
I re-ran the idle test over several days, running from the same fully charged state to a completely empty battery, and compared runs. I got variability in the duration of the test (+/- 5%). Also, comparing estimated power consumption at the 100%, 75%, 50% and 25% battery capacity points also shows a lot of variability. This means one cannot get accurate and repeatable power estimations even when the battery is charged at specific capacities.
So next time somebody tells you that the latest changes made their low power device suck more (or less!) power than the previous release and their findings are based on data derived from battery fuel gauge, take it with a pinch of salt.
The only reliable way to measure instantaneous power consumption is using specialised precision equipment that has been accurately calibrated.Read more