Forums - Software Power Measurement Best Practices (Updated)

1 post / 0 new
Software Power Measurement Best Practices (Updated)
ToolsPM
Join Date: 15 Feb 13
Posts: 393
Posted: Wed, 2014-12-03 10:58

Note: An updated version of this document is located here: http://mostly-tech.com/2015/05/28/how-to-measure-the-power-consumption-of-your-mobile-app-using-free-software/

Software Power Measurement Best Practices

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

  1. 1. Remove your USB cable – Trepn cannot display accurate power readings when your mobile device is charging or connected to a computer.
  2.  
  3. Tip: Use ADB over Wi-Fi as described here, but be aware that this could cause power spikes that slightly increase your power averages. 
  4.  
  5. 2. 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 Trepn data points in Settings. 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 readings like 0 or 1.80mW, your device cannot display accurate battery power.
  6.  
  7. 3. Make sure your processor stays awake – Check “Acquire Wakelock while Profiling” on the Trepn General Settings page. Why this is needed: Without forcing the processor to stay awake, the average power reading was 1223mW. With a processor wakelock set, the power measured was 301mW. That’s a difference of over 900mW and shows how important this setting can be. When the processor goes to sleep, data collection in Trepn could temporarily stop, or power readings could drop to a level that is lower than it should be. When data collection stops for long periods, your average power readings could be higher than they should be, because Trepn will average any power spikes over a much 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.  
  8.  
  9. 4. 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 remaining 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. Recommendations: 
  10.  
  11. - Pure Android devices like the Nexus 5 or Nexus 7 are better for testing, because they have fewer preinstalled apps and less services running in the background.
  12. - Don’t check more data points than you need. This increases system resource consumption.
  13. - Make sure “Show Per-Application Statistics” is unchecked -- unless you need to see the mobile and Wi-Fi data transmitted.
  14. - 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 list here.
  15. - 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.
  16. - Turn off "Google Now" to prevent your device from downloading cards in the background and always listening for the "OK Google" keyword (if you've set it up to do so).
  17. - Consider uninstalling apps like Microsoft’s “One Drive” or Nokia’s “Here” that relaunch themselves after you close them.
  18. - Do not setup your device for use with multiple users.
  19. - Avoid using your device with a wearable, because they require that multiple apps are running at once and Bluetooth is always active.
  20. - 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.
  21.  
    1. 5. 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 updating software in the background. Other things you may wish to turn off: Display (when possible), Bluetooth, Location (GPS), Wi-Fi and Mobile networks (if not already in Airplane mode).
    2.  
    3. 6. 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:  
    4.  
    5. - Use a stopwatch to make sure your tests run the same duration every time.
    6. - 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.
    7. - 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. 
    8. - Be very aware of your screen background. Light backgrounds use considerably more power than dark backgrounds. Try to be consistent and document what the background is on each test (e.g. stock Nexus 6 home screen).
    9. - 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.
    10.  
    11. 7. Minimize the impact of the screen – The display and its backlight are often the biggest consumers of power in a mobile device.
    12.  
    13.  
    14. - 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.
  22.  
  23.      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. - Always document screen brightness levels to make sure you are consistent.
    2.  
    3. 8. Compare apples to apples – Don’t try to 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. 
    4.  

Hopefully you will find these tips to be helpful. If you have any tips of your own, please share them below. 

- Rick

 

 

  1.  
  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.