Android* Power Measurement Techniques

by Tuan H. Bui

Overview

Battery life is an important factor in providing excellent user experience for smartphones and tablet devices. These devices are intended to last well over 10 hours in normal operation mode and days, if not weeks, in standby mode on a single battery charge.

Understanding power consumption of a device while running an application will help application developer make appropriate software design choices to minimize device power consumption.

This note discusses techniques to obtain power data while an application is running.

Discussion

Android operating system provides a number of power related performance data in the /sys/class/power_supply/battery/uevent datafile1. The uevent datafile is updated by the battery device driver in Android. The frequency of update can vary from every hundredth of a second to as long as 30-40 seconds. The amount of information includes in these datafiles varies with different devices. The data here are from the Motorola Xoom running Android Honeycomb.

Event Name Motorola Xoom
POWER_SUPPLY_PRESENT Yes
POWER_SUPPLY_NAME Yes
POWER_SUPPLY_STATUS Yes
POWER_SUPPLY_TECHNOLOGY Yes
POWER_SUPPLY_VOLTAGE_NOW Yes
POWER_SUPPLY_VOLTAGE_AVG No
POWER_SUPPLY_CURRENT_NOW Yes
POWER_SUPPLY_CURRENT_AVG Yes
POWER_SUPPLY_CHARGE_FULL No
POWER_SUPPLY_CHARGE_NOW No
POWER_SUPPLY_CHARGE_COUNTER Yes
POWER_SUPPLY_CAPACITY Yes


The meaning of the event names are described below:

Power Supply Present: indication that there is a power supply. Value of this event should always be 1.
Power Supply Name: name of the power supply. These are names assigned to the various devices that are capable of suppling power to the devices such as ‘battery’, ‘ac_charger’, ‘usb’ etc… The battery is our primary concern in this note.
Power Supply Status: indicating whether the device is being charged or not.
Power Supply Technology: battery technology. Common values are Lithium-Ion (Li-Ion)
Power Supply Voltage Now: battery voltage in microvolts (uV). Some other devices may express these values in milivolts (mV)
Power Supply Voltage Avg: average battery voltage.
Power_Supply Current Now: battery current in micro-amperes (uA).
Power Supply Current Avg: average battery current.
Power Supply Charge Now: remaining charge left in battery in uAh (micro ampere-hour). Battery capacity is normally specified in mAh or in Wh (Watt-Hr).
Power Supply Capacity: remaining battery capacity in percentage.
Power Supply Charge Full: amout of energy the battery will hold. This is usually the 100% charged level of the battery.



We will describe different methods of computing power consumption with the type of data reported by the battery device driver.

When both voltage and current readings are provided, computing power consumption is a simple matter of multiplying the voltage by current to obtain power consumption in watt.

Average Power = (Average Voltage * Average Current) / 1e9
Battery Capacity Consumed = (Average Current * Workload Duration) / 1e3
Battery Life = Battery Charge Full / Battery Capacity Consumed

Where:
Workload duration is measured in hour
Average Power is expressed in mW
Battery Capacity Consumed is expressed in mAh
If Battery Charge Full is not provided, the battery rating from the device manufacturer can be substitute. Battery rating is usually available as part of device specifications from the device manufacturer.


Example: Playing a 30 minutes video clip on a device draw an average current of 450,000 microampere at an average voltage of 7200000 microvolt. Assuming a battery rating of 3200 mAh, using the formula above, we compute an average power consumption of 3,240 mW, consuming 225 mAh for a battery life of ~ 14 hours. This is the best case battery life assuming that the Android OS can play video until the very last mAh was drained. In reality, OS will shutdown the device when remaining battery capacity reaches some minimum value, typically 2 to 5% remaining.

Some devices only report Power_Supply_Capacity along with Average_Voltage. In this case, we need additional information from the device manufacturer, Battery Rating to calculate power consumption. Assume this data is available, Average Power, Energy Consumed and projected battery life can be computed in the following way:

Battery Percentage Used = Start Battery Capacity – End Battery Capacity
Battery Capacity Used = Battery Percentage Used * Battery Rating
Average Current = Battery Capacity Used / Workload Duration
Average Power = Average Voltage * Average Current


Example: a 30 minute video chat session consumed 15% of the battery capacity with an average voltage of 7.2 volts. Assuming a 3200 mAh battery, we compute an average current drain of 960 mA and an average power of ~ 6912 mW.

The accuracy of this technique relies on a fairly long running workload that consumes a reasonable percentage of the battery capacity.

There are many variables that will impact power consumption of a device and needs to be tightly controlled to get consisten power measurements. Some of those important variables are:

  • Display brightness. The display panel can consume 1 to 3 watts of power from minimum brightness setting to maximum brightness setting. Ensuring a consistent brightness setting between experiments is essential for meaningful power measurement. The ambience light sensor (ALS) can also modulate the display brightness depending on the ambience light level and should be disabled for power measurement.
  • Applications and services running in the background. A task manager should be used to kill as many non-essential background applications and services as possible to ensure a consistent measurement environment.
  • WiFi, GPS, BlueTooth can drain significant amount of power. GPS and BlueTooth should be turn off during power measurement if the application under test doesn’t require their use. WiFi is essential for Android functionality and should be left on.
  • USB devices should be disconnected during power measurement unless the application under test requires USB devices.
  • Power dissipation of loudspeaker varies significantly with the type of music being played as well as sound volume. To minimize these variations, sound volume should be set to a fixed level and headphone used.
  • Moving the device will activate different sensors and associated device drivers to process those sensors output. Device should not be moved or touch excessively during power measurement.

Summary

Understanding power consumption of an application is the first step to improving its power efficiency. Ensuring a consistent operating environment is essential for obtaining useful power data of application.

Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.