People care about battery life. They want to know that when they pick up their phone it will work for them, and that their friends can reach them at any time. That’s why it’s basic courtesy for developers to make sure their software is energy efficient. If they’re squandering battery power, users will soon desert them.
One of the challenges is working out how to optimise your app for its power consumption. There’s a free tool available from Google Play (the new name for the Android Marketplace) called the Intel Power Monitoring tool. This runs in the background while your app is running and provides a continuous feed of metrics you can use to analyse your app’s impact on battery life. They include the current battery discharged value, the CPU frequencies and utilisation, WiFi packets sent and received, the state of the app and the number of threads. You can choose how often the analytics are sampled, with intervals as low as 1 second.
There is a CPU utilisation (and hence battery life) overhead with using this tool, of course, but it’s negligible. If you’re sampling at 1 second intervals, it’s 3% and it falls to 0.02% if you sample at 10 second increments.
The metrics are shown in near-real time in the status bar at the bottom of the screen of your Android device, and are also output (with their time stamps) to a log file, which you can configure to be automatically emailed to you.
It’s possible to use the tool to find bugs that have an impact on battery life, such as infinite loops that might be eating up the CPU and power resources, or the tool could be used to diagnose malicious software draining a device’s battery. For more information on the tool, see Intel’s briefing on it.
Have you tried it? What do you reckon?