How to Power Profile A Mobile App Using Hardware

This article is the second in a series for mobile software developers. The first article can be found here. It is intended to help developers create apps with better battery life. This article will focus on Best Practices for hardware power measurement. This is something every developer should care about because reducing power consumption results in longer battery life and happier users.

Battery life is now the number one thing consumers care about. Developers need to take action to ensure their app doesn’t not consume too much power, but most of them have no idea how much power there app consumes. You could use software like GameBench or Trepn Profiler to measure power consumption, but those run on your device. Collecting large amounts of power data and storing it locally consumes CPU cycles, which can inflate power readings. Another problem is the fact that popular devices from Samsung don’t report accurate direct power readings. With these devices, you need to measure power using an off-target hardware-based solution. This article shows you how it’s done.

Monsoon

Good Power Meters Aren’t Cheap

There are different ways to measure the power consumed by mobile devices, but the most popular off-target method is using a Monsoon Power Monitor. This $771 device effectively replaces the battery on your phone. It can measure the voltage, current and power and connects to special PC software which provides control over power data is collected and displayed. After your Monsoon arrives, you need to download this software and documentation from their website. You also need bypass the battery in your phone, so the Monsoon can power it. Although you could connect two banana to mini-grabber cables directly to your phone, the battery gauge and temperature monitoring won’t work unless you leave the battery in and use insulated copper tape as described in the Monsoon manual. Their user guide describes how to prepare your phone so it can be connected to a Monsoon Power Monitor. Once you’ve modified your battery, you’ll need to determine how you are going to charge it. In most cases you’ll just fold back the copper tape on the plus terminal so that battery charges normally. If you have a phone like a Nexus 6, which doesn’t have a removable battery, you got a challenge on your hands. Checkout the Appendix at the end of this article to see why.

It easy to measure power on a phone with a removable battery

It easy to measure power on a phone with a removable battery

Connecting Your Device

Now that you’ve modified your battery, you’re ready to connect your phone to the Monsoon. If you haven’t done so already, download and install the Monsoon software and connect a USB cable to the of the power monitor, so you can install the drivers as described in the manual. Before connecting your phone to the Monsoon you need to perform one final test. Connect your modified battery to the red and black banana plugs on the front on the Monsoon. Make sure the Monsoon is off and press the power button on your phone. If the phone powers up, the connection to the battery has not been broken. Now launch the ‘Power Tool’ software on your PC and turn on the Monsoon. The LED on the front panel of the Monsoon should be green. Press the ‘Refresh’ button and highlight your device on the PC software and click on the Select button. If the software can’t communicate with the Monsoon, power cycle the Power Monitor.Capture3By default, the power supply on the Monsoon is turned off, so you’ll need to turn it on and set the proper voltage. Click on ‘Set Vout’ and enter the proper value for your device. Next, enable ‘Vout,’ and enter the size of your battery. Once you confirm VOUT is enabled on the software, you can power up your phone. Wait until the Android home screen is displayed until you proceed. Next, connect a cable from the USB out on the front of the Monsoon to your device. This will be used to control your device remotely. When USB passthrough mode is set to AUTO, once sampling is started, the direct USB connection is disabled, charging over USB is disabled and samples are measured without the interference of USB charging. As soon as sampling is stopped, the direct USB connection is re-enabled and data can once again be transferred to and from the device over USB

Sizing Up Your App

You should perform a series of tests with your app, and similar apps, so you know how your app compares to the competition. You should measure idle power consumption, average power consumption and peak power consumption. You’ll find step-by-step directions below how to do this.

Measuring Idle Power Consumption

Measuring the power consumed when an app is doing nothing and comparing it to the idle power consumption of your device can show if the app under test is keeping the screen or processor awake. It can also identify problems with analytics and ads. Start by measuring the baseline idle power consumption of your device without any apps running. Since the screen is such a large consumer of power, you should measure idle power with the screen off as well as on and carefully document the screen brightness level. The chart below shows how much power an idle Nexus 6 consumes at various screen brightness levels. Brightness levels are set via ADB script — not using the Android OS slider.

Power consumed by a Nexus 6 at various brightness levels

Power consumed by a Nexus 6 at various brightness levels

Preparing to measure power

    1. Connect your mobile device to the Monsoon Power Monitor.
    2. Launch the Monsoon PowerTool software on your PC and enable Vout as described above.
    3. Power up your smartphone or tablet and wait 5-6 minutes.
    4. Check ‘Power Avg’ on the Monsoon and set the units to mW (100 units/tick).
    5. Turn off all unneeded features like Wi-Fi and Sync and put your device in ‘Airplane Mode.’
    6. Go to Settings and launch the Application Manager. Stop all unneeded apps and services under the ‘Running’ heading.

A full list of Best Practices for the Monsoon is posted at the bottom of this article.

Measuring the idle power of your device and software
Monsoon1

  1. Press the RUN button to start recording power consumption.
  2. Don’t touch your device for at least 60 seconds.
  3. Press the STOP button when you are finished recording and select the on-screen region you want to use for your average. It’s a good idea to record average power readings with and without spikes. To filter out spikes and get a more accurate average, select a region on the Monsoon software without any large spikes (as shown on the right). This should only be done for idle power measurements when you believe the spikes are caused by other apps or the operating system.

Here are some idle power measurements taken on a Samsung Galaxy Note 3 with no apps running in the foreground.

    • Average idle power – screen off – 15.6 mW (without spikes)
    • Average idle power – screen off – 27.8 mW (with spikes)
    • Average idle power – screen brightness min. – 391 mW (without spikes)
    • Average idle power – screen brightness min. – 410 mW (with spikes)
    • Average idle power – screen 50% – 528 mW (without spikes)
    • Average idle power – screen 50% – 557 mW (with spikes)
    • Average idle power – screen 100% – 870 mW (without spikes)
    • Average idle power – screen 100% – 882 mW (with spikes)

For comparison purposes, here are a few idle power readings for a Nexus 6 with no apps running in the foreground. The Nexus 6 has a larger screen with considerably more pixels (2560×1440 vs. 1920×1080). This probably accounts for most of the difference in power consumption between these two devices.

  • Average idle power – screen off – 20 mW (without spikes)
  • Average idle power – screen 50% to 100% – 660mW to 1200 mW (including spikes)
  1. After you finish measuring the idle power of your device, launch your app and measure the idle power when it is running. In theory this should be similar to the idle power of the device, but often it’s higher. By comparing the idle power of your app with similar apps, you can determine if your app has a problem.

Here are some idle power measurements taken on a Samsung Galaxy Note 3 before playing two different games:

  • Average power No app running (idle) – 557 mW
  • Average power Temple Run (idle) – 1575 mW (during the first minute while screen awake)
  • Average power Temple Run (idle) – 720 mW (after the screen dims about 60 seconds into the test)
  • Average power Asphalt 8: Airborne (idle) – 2139 mW

Test Details: Duration: 2:00 Screen brightness: 50%; Airplane Mode: On; Wi-Fi enabled (Asphalt 8 – Won’t run without Wi-Fi); All readings above include power spikes.

There are several reasons why Asphalt 8 consumes 36% more power than Temple Run during the first minute of testing. Asphalt 8 has nice visual effects and sound and Temple Run does not. However, when you let the test run for two minutes, Asphalt 8 consumes 197% more power. The biggest reason for the discrepancy is because Asphalt 8 holds a full wakelock, which never lets the screen go to sleep, while Temple Run lets the screen dim after the user defined interval. In my test, this was set to 60 seconds.

Measuring Average Power Consumption

Here are some average power measurements taken on a Samsung Galaxy Note 3 with the same games tested above:

  • Average power Temple Run (in-use) – 1629 mW
  • Average power Asphalt 8: Airborne – [TBD] mW

Test Details: Screen brightness: 50%; Airplane Mode: On; Wi-Fi enabled; All readings above include power spikes.

Measuring Peak Power Consumption

Before measuring the peak power that your software consumes you may want to measure the peak power of one or more popular benchmarks since that will establish a top limit of the power which can be consumed by your device.

Here are some peak power readings taken on the Samsung Galaxy Note 3 for some popular benchmarks:

  • AnTuTu Benchmark v5.7 – Max. power – 9761 mW
  • AnTuTu System Stability Test – Max. power – 9855 mW
  • GFXBench 3.0 – Max. power – 10497 mW (graph shown below)

Test Details: Device: Samsung Galaxy Note 3; Airplane mode: On (except for GFXBench); Wi-Fi: Off; Screen Brightness: 100%; Bluetooth: Off; Sync: Off

benchmark

Power Measurement is Fun

Having a better understanding of mobile power consumption will help you to make more power efficient apps. ThemesThe thought is, if you can measure it, you can act on it. You can make changes to your code and see what the affect is. You can see how your app compares to the competition. You can also answer power-related questions like the following:

Q: Do dark themes really save power?
A: Yes. The average power consumed by the Google News & Weather app with a light theme selected is 893 mW. With a dark theme selected, only 410 mW of power is consumed. That’s a savings of 54%!
theme charts
Test Details: Device: Samsung Galaxy Note 3 with AMOLED display; Airplane mode – On; Wi-Fi: Off; Brightness level – 50% according to slider; Screen mode – Standard; Auto-adjust screen tone – Disabled

Q: Should my app wait to perform certain tasks until a user is on a Wi-Fi network?

A: The answer to this question depends in part on the type of app and the signal strength of your networks. If your app transfers large amounts of data, you should wait until the user connects to Wi-Fi when possible. In the test below I download a 100MB file from a website. Over Wi-Fi the average power consumption was 997 mW and the download took about 65 seconds. Over 4G, the average power consumption was 2291 mW and the download took about 195 seconds. Bottom line: Transmitting large amounts of data over a 4G cellular radio can use over twice as much power. One reason for the high cellular power consumption in my test may be related to signal strength, which only showed 2-bars. Under conditions like that, the phone has to amplify the signal more.

Well-designed apps only download files when the user is connected to Wi-Fi, but give the user the ability override this setting if desired. This is a good approach to follow. Google has code snippets online that show how this can be done.

LTE2

Monsoon Tips & Tricks

The Monsoon User Guide is very long, but doesn’t include any tips how to get the most out of it. As a result, I’ve included some suggestions here:
Cursors

    • To quickly identify minimum and maximum power readings, use cursors as shown on the right. You can also export the results of a profiling session as a CSV file. However, this isn’t ideal, because it takes a long time to export this data and Excel often fails to import all of it. If you do go this route for shorter profiling sessions, use the Statistical MIN and MAX formulas under the Formulas tab/More Functions.

 

  • If you get a message saying the Monsoon isn’t communicating with your computer, or you can’t start or stop profiling, try power cycling the Monsoon hardware first. If that doesn’t work, reboot your computer.

 

 

  • Immediately after starting the Monsoon software, sometimes accurate readings aren’t displayed. Pressing the ‘Run’ button seems to help fix this problem.

 

Range

 

  • It’s a good idea to use your mouse to set the range of data you wish used to compute the average (as shown on the on the right). This allows you to disregard data at the beginning or end of a profiling session for more accurate readings.

 

 

  • You may see the calibration status indicator on the Monsoon software go yellow or red for a few seconds. According to Monsoon support, this doesn’t necessarily mean anything is wrong. If it stays in this state for longer periods, you should investigate.

 

 

  • If your power peaks are off-screen, change the units from mW to W.

 

 

  • You can turn on any of the available graphs at any time – even if they weren’t enabled when you captured your power data. This is helpful if you want to see the relationship of average power to peak power, or compare maximum power and current readings.

 

 

  • Under very heavy loads, you might notice the voltage on the Monsoon hardware drops slightly.

 

 

  • The Monsoon software drivers appear to have some stability issues and can cause blue screen crashes. As a result, I recommend you don’t leave it connected to your PC’s USB jack when you are not using it.

 

 

  • Make sure to use the offset feature to on power and current values to make your results more clear.

 

Hardware Power Measurement Best Practices

Here are some best practices you should follow if you want the most accurate power measurements:
QuickSettings

    • Your screen is the single biggest consumer of power and can skew your readings if you don’t consider the following: Make sure the screen brightness does not change between tests. Do not enable ‘Auto’ brightness. Also, turn down your screen brightness to the lowest possible level when taking power measurements. When possible, turn off the screen entirely.

 

  • Go to Settings and select the Application manager. Swipe to the left until you can see the list of running apps. Close all unneeded apps and stop all unneeded services.

 

 

  • Turn off all unneeded features including Wi-Fi, Mobile data, Bluetooth, Location, NFC, Sync, Download booster, etc. Most phones let you do this by swiping down to access a Quick Settings screen like the one shown on the right. Notice how almost everything is turned off. You may want to also turn off all syncing options under Settings > Accounts > Google.

 

 

  • Most popular apps have analytics that send data to the cloud periodically. To prevent this for occurring, turn on ‘Airplane Mode,’ and turn off Wi-Fi if your app doesn’t need to communicate with the cloud. This will also prevent apps from automatically downloading updates in the background.

 

AppsRunning

 

  • If you’re serious about power profiling, consider purchasing a Nexus phone or tablet and only install a minimal number of apps on it. Having lots of apps running in the background affects the accuracy of power measurements. My LTE-enabled Nexus 7 only has 3 apps running on it, while my Verizon Galaxy Note 3, still has 22 or more apps running in the background — after I’ve closed all apps and stopped all unneeded processes.

 

 

  • If you are purchasing a new device for power modelling, choose a device with a removable battery that you can easily access with and contacts that you can clip on to.

 

 

  • Time your tests. Make sure each test is at least a minute. Longer runs minimize the impact of power spikes on averages.

 

 

  • Run each test at least two or three times and average the results. Throw out any values that are noticeably higher than the rest and retest. Even with Airplane mode on and Wi-Fi off, the OS and apps on your device still work in the background. This causes power spikes that can affect the accuracy of your readings. If you have a rooted device, consider using software like RepetiTouch to record your keystrokes. This will ensure your test runs are the same each time.

 

 

  • Consider uninstalling apps that relaunch after you close them like Microsoft’s ‘One Drive’ or Nokia’s ‘Here.’

 

 

  • Do not setup your device for use with multiple users because that makes it harder to close all of the background apps.

 

 

  • Turn off ‘Google Now’ as follows: Turn off “Ok Google” Detection by going to Settings > Accounts > Google > Search > Voice. Select “Ok Google” detection and turn off ‘From the Google app’ and ‘From any screen.’ Turn off ‘Show cards’ under Settings > Accounts > Google > Search > ‘Now cards.’

 

 

  • Pause or disable step counters like ‘S Health’ or ‘Google Fit.’ These apps can consume significant CPU cycles while your device is idle.

 

 

  • Avoid using your power measurement device with a wearable. Wearables require that Bluetooth is active and have cause multiple apps to run in the background.

 

 

  • Make sure your computer doesn’t go to sleep when you are capturing data. If it does, you could lose data. To do so, make sure your PC is charging via AC adapter and not running on battery. Set your power profile so your hard disk goes to sleep after 30 minutes. Set your processor and screen so it never goes to sleep when connected to a power source. Turn off your screen saver. Move your mouse from time to time to let the computer know you are still using it.

 

 

  • It’s normal for your phone to do housekeeping after it start up. Wait 5 or 6 minutes after powering up your mobile device before profiling it. I’ve seen power spikes over 8 watts after the Android home screen is visible and the boot up process appears to be complete. Power consumption over 6 watts for 30 seconds or longer isn’t unusual. Sometimes these high power readings are related to app updates, but I’ve also seen this occur in ‘Airplane Mode,’ with Wi-Fi off. These spikes will inflate your power measurements and often have no relation to the activity you are attempting to measure.

 

Spikes

Appendix – Preparing a Nexus 6 for Power Monitoring

Phones like the Nexus 6 do not have a replaceable batteries. This makes it very challenging to connect power measurement tools like a Monsoon to them. First, you’ll have to get special tools to remove the back of your phone. The iFixit website shows you how to remove the back cover and get access to its battery. You’ll need a special Torx screwdriver to get access the battery of the Nexus 6. Before you order that screwdriver and remove the 22 screws, you should read the next two sections. It could save you some time.

Nexus 6 screws
Sadly after almost completely disassembling my phone, I learned that the battery in the Nexus 6 does not have metal pads like a most cell phones. doorIt has a flex cable that connects to a small 4-pin jack that can be seen under a hidden door (shown on the right). After learning about the special power connector in the Nexus 6, I contacted Monsoon support thinking they must sell a cable assembly for this popular developer device. The Monsoon support rep said they didn’t know how to connect a Monsoon to the Nexus 6, so I referred to their manual, which shows how to create a battery bypass, using flat copper foil and special insulating tape. It’s important that you bypass the battery in your phone, so the Monsoon can power the device. However, the battery needs to remain in place for thermal monitoring and use by the battery fuel gauge. Now that the battery has been bypassed, you’ll need to determine how you are going to charge it. More about that later. I first tried to connect insulated copper tape to the same pads that are used for wireless charging on the Nexus 6, but for some reason that didn’t take the battery out of the circuit. Out of frustration, I took the device to my company’s proto lab for assistance.Wires modThey determined which of the wires on the 4-pin connector were the + and – and broke the connection to the positive wire, so the battery would no longer be in the circuit. You can see their mod on the left. The black wire is attached to a small pad on the Nexus circuit board that is connected to the minus terminal of the battery. The red wire is connected to the + power input on the circuit board. The red wire is connected to a trace that was previously connected to the + side of the battery, but that trace was cut to break the connection, so the Monsoon can power the phone. The gray wire is attached to a pad that connects to the + battery terminal. By mating the red and white banana plugs (as shown on the right), the connection to battery is restored, so it can be charged normally over USB.

Before You Begin

This section isn’t intended to be a how-to. It’s intended to discourage most developers from attempting a mod like this. Before you disassemble your expensive Nexus 6, you need to make sure that you are willing to take the risks described here. If you haven’t done circuit board modifications before, or don’t have all of the proper equipment, don’t attempt this. Your chances of success are poor. I think you’d be better off using a phone with a removable battery like a Samsung Galaxy Note 3 or Galaxy Note 4 for power measurement. You should be able to purchase those for $99 to $299, and they are much easier to connect to a Monsoon Power Monitor. In fact, in a pinch you can connect two banana to mini-grabber cables to a Note 3 without any modifying your phone or battery. It works fine, but the battery gauge won’t work unless you leave the battery in and use insulated copper tape as described in the Monsoon User Guide. If you want a to power model a Nexus phone, keep in mind that the Nexus 4, Nexus 5 and Nexus 6 report accurate battery power using Trepn Profiler, or other software, so you don’t even need a Monsoon. If you decide to try this mod despite my warnings, you are on your own. I cannot answer any questions about this, nor can I be responsible if you damage your device.

– Rick

Copyright 2015 Rick Schwartz. All rights reserved. Linking to this article is encouraged. All of the comments in this blog are Rick’s alone, and do not reflect the views of his employer.
Follow me on Twitter @mostlytech1

Useful Links
Monsoon Tips
Hardware Power Measurement Best Practices

How to Measure Power Consumption Using Free Software

This article is the first in a series for mobile software developers. It is intended to help developers create apps with better battery life. Most developers don’t know if their app has a problem with excessive power consumption, because they don’t have an effective way to measure the amount of power their app consumes. If you can measure it, you can act on it. This article will focus on Best Practices for software power measurement. A subsequent article will show you how to measure power consumption using specialized hardware. Reducing power consumption results in longer battery life and happier users.

It's easy to measure the power consumption of a mobile device

It’s easy to measure the power consumption of a mobile device

There are two different ways to measure power on a mobile device. You can do it using hardware or software. I’ll cover the hardware-based method in a separate article. This post will focus on software-based power measurement. Trepn Profiler is an Android application that can display the real-time power consumption on a smartphone or tablet. I happen to work on the team who created it, but I that’s not why I include it in this article. I include it because it’s the only app I’ve found that reports accurate real-time power consumption. GameBench is a great app, but the current version has to run a few minutes before power data is reported. If you are aware of other app that report accurate real-time power, please mention them in the comments section below and I will include them in this article. Because Trepn runs on-target, your mobile device doesn’t have to be connected to a computer or special hardware in order to capture power data. You can use your phone on-the-go, and profile in the foreground or background. If you want to give it a try, Trepn is available as a free download from Google Play.

Here are just a few of the questions you can answer with software like Trepn Profiler:

  • Which Android video conferencing app uses less power: Google Hangouts, ooVoo, Skype, Tango or Viber?
  • Should I wait to download updates over Wi-Fi if my battery is low and I’m only getting two bars?
  • How much more power does a free app with ads consume over a paid app without ads?
  • Does a dark background really consume less power than a light one?
  • How much power do I save when I use hardware decoding on a high-resolution video file?
  • Does that new phone you’re considering buying consume more or less power than your current one?
  • What is the impact of settings on power consumption (e.g. do you save noticeable amounts of power when you turn off Bluetooth, Wi-Fi or 4G?)
  • Which activity consumes more power? Gaming or 4K video recording?


Before you start profiling, there are several things you should do to increase your chances of getting the most accurate power measurements possible.

Software Power Measurement Best Practices

Here are some best practices for measuring power with Trepn Profiler:

  1. Remove your USB cable – Trepn cannot display accurate power readings when your mobile device is charging or connected to a computer.

Tip: If you need a USB connection for device control and data transfer, use ADB over Wi-Fi as described here, but be aware it can cause power spikes that slightly increase your power readings.

  1. Make sure your device reports accurate battery power – How do you know if your device reports accurate battery power?  Battery power should appear in the list of data points in Trepn Profiler. After you check the “Battery Power” data point, touch the Back button and “Profile System.” Then go to “Stats” view.” You should see a value in the average power column when your device is idle between 400mW to 1000mW for smartphones with 4” to 5” screens, 700 mW to 2500mW for 6” smartphones or 7” tablets, and 2000mW to 4000mW for 10” or larger tablets. Devices that are known to report accurate battery power are listed here. If you see values like 0 or 1.80mW, your device cannot display accurate battery power.

awake

  1. Make sure your processor stays awake– To do this, check “Acquire Wakelock while Profiling” on the Trepn General Settings page. To illustrate the importance of this, I did two power tests Without forcing the processor to stay awake, the average power reading was 456mW. With a processor wakelock set, the power was 249mW. That’s an 83% error, which shows how important this setting can be. When the processor goes to sleep, data collection in Trepn may temporarily stop, or power readings can jump to levels that are lower or higher than they should be. When data collection stops for long periods, your average power readings will be higher than they should be, because Trepn will average any power spikes over a shorter time period. The only time you should not check “Acquire wakelocks…” is when you are using Trepn to test whether an app is keeping the processor awake by holding a partial wakelock.

asleep

  1. Minimize background processes/reduce system overhead – It’s not enough to close everything in Recent Apps. Open the Apps manager, go to Running and close all unneeded apps and stop all unneeded services.  How much power can background apps consume? I measured 1043mW power on my idle tablet before I closed all unused apps. After closing unused apps the power consumed dropped to 726mW. That’s a 30% reduction in power. Here are some recommendations how to minimize background activity:
    Minimize the number of apps you have running

    Minimize the number of apps you have running

      • Pure Android devices like the Nexus 5 or Nexus 7 are better for testing, because they have fewer preinstalled apps and less things running in the background.
      • Don’t check more data points than you need. This increases system resource consumption.
      • Make sure “Show Per-Application Statistics” is unchecked — unless you need to see the mobile and Wi-Fi data transmitted.
      • Profile in the background with no visible graphs or on-screen overlays. This results in almost half the power consumption, and more accurate power readings. After profiling, data can be viewed or saved so it can be analyzed later. Step-by-step instructions are listed here.
      • Pause or disable step counters like “S Health” or “Google Fit.” These apps can consume significant amounts of CPU cycles while your mobile device is idle.
    Turn off step-counters and always-listening apps like Google Now

    Turn off step-counters and always-listening apps like Google Now

      • Turn off ‘Google Now’ as follows: Turn off “Ok Google” Detection by going to Settings > Accounts > Google > Search > Voice. Select “Ok Google” detection and turn off ‘From the Google app’ and ‘From any screen.’ Turn off ‘Show cards’ under Settings > Accounts > Google > Search > ‘Now cards.’
      • Consider uninstalling apps like Microsoft’s “One Drive” or Nokia’s “Here” that relaunch themselves after you close them.
    Use  Quick Settings to turn off things like sync

    Use Quick Settings to turn off things like sync

    • Do not setup your device for use with multiple users.
    • Avoid using your device with a wearable, because they require that multiple apps are running at once and Bluetooth is always active.
    • Most popular apps have analytics that send data to the cloud periodically. To prevent this, turn on Airplane mode if your app doesn’t need to communicate with the cloud.
  2. Focus on what you’re measuring – Turn off everything that is not related to what you want to measure. If network connectivity is not needed, put your device in Airplane Mode. This will prevent your device from doing software updates in the background. Make sure Wi-Fi is off too. Some devices turn it off automatically when Airplane mode is enabled, others do not. Other things you may wish to turn off: Display (when possible), Ambient screen, Bluetooth, Location (GPS), Wi-Fi and Mobile networks (if not already in Airplane Mode).You may want to also turn off all syncing options under Settings > Accounts > Google. When performing screen power tests, set to processor to its lowest possible frequency to reduce effect of CPU on power.
  1. Be precise and test several times – It’s important that you are consistent and confirm your test results by retesting. Here are some suggestions how to do this:
    Dark backgrounds use much less power

    Dark backgrounds use much less power

    • Be very aware of your screen background. Light backgrounds use more power than dark backgrounds. How much more? The average power consumed by the Google News & Weather app with a light theme selected is 893 mW. With a dark theme selected, only 410 mW of power is consumed. That’s a power reduction of 54%.
    • Use a stopwatch to make sure your tests run the same duration every time.
    • When measuring average power consumption, profile for at least two minutes in Trepn Profiler’s Advanced Mode. Then save your results as a Trepn .db file. Touch the “Analyze Run” button and select the saved file. This will provide more accurate average values than the ones displayed while profiling.
    • Run each test at least two or three times and average the results. Throw out any values that are noticeably higher than the rest and retest. If you have a rooted device, consider using software like RepetiTouch to record your keystrokes. This will ensure your test runs are the same each time.
    • Keep everything as close to the same as possible on your tests, including background apps and services. After you finish a test, go back and check the running apps, if the list of apps is different, close the newly opened apps and test again.
  1. Minimize the impact of the screen – The display and its backlight are often the biggest consumers of power in a mobile device. 
  2. Always document screen brightness levels to make sure you are consistent.
  3. Turn screen brightness to the lowest possible level on your tests. Avoid using the Android Settings page to set screen brightness levels because the slider calibration varies from device to device. Also slider settings are not easily reproducible.
  4.  

    For rooted commercial devices (set brightness to 10):

    adb shell “su -c ‘echo 10 > /sys/class/leds/lcd-backlight/brightness'”

     

    For rooted MDPs:

    adb root
    adb wait-for-device
    adb remount
    adb shell “echo 10 > /sys/class/leds/lcd-backlight/brightness”

    1. Compare apples to apples – Don’t compare on-target measurements with off-target (e.g. Monsoon Power Monitor) measurements. On-target measurements and always going to be higher – sometimes significantly higher, so you cannot compare them with off-target measurements using hardware. However, when you run Trepn on a device connected to a Monsoon, you’ll find it’s very accurate (as shown in the chart below).
    Trepn is surprisingly  accurate -- even when compared to expensive hardware like the Monsoon Power Monitor

    Trepn is surprisingly accurate — even when compared to expensive hardware like a Monsoon Power Monitor

    After using Trepn, you should know exactly how much power your app consumes. Measure the power your app uses when idle and in-use and compare this with apps of the same type. A follow-up article will tell you how to reduce the power consumption of your app.

– Rick

Copyright 2015 Rick Schwartz. All rights reserved. Linking to this article is encouraged. All of the comments in this blog are Rick’s alone, and do not reflect the views of his employer.
Follow me on Twitter @mostlytech1

Software Power Measurement Best Practices