Better Battery Stats Guide

Better Battery Stats Guide
We all know how ungrateful the best of... well, anything are on Android. But in case of BBS we should make an exception. As far as checking for battery drains on your phone goes this truly is the ultimate app.


Here you will find details about how the views and options of BetterBatteryStatistics are organised. Further information about using BetterBatteryStats is located bellow in the how to.

REFERENCES

bbs1.png

BetterBatteryStats does not collect data in the background but uses references saved at specific times (on specific events):
  • Boot: is saved when your phone boots, deletes all other refrences
  • Unplug: is saved when you unplug your phone from the charger
  • Charged: is saved when your phone gets charged to 100%
  • Screen Off: is saved when the screen of your phone goes off
  • Custom: is saved when you select the option to save a custom reference from the menu

As long as those events did not occur or after a reboot BBS will notify you about a missing reference. This is not a bug, it's the way BBS was designed

VIEWS

bbs3.png

These are the statistics:
  • Other: shows sleep, awake and screen on as well as other important times
  • Kernel Wakelocks: shows the total time and the count of Kernel wakelocks
  • Partial wakelocks: shows the total time and the count of partial wakelocks
  • Alarms: shows the wakeups caused by applications or services
  • Network: shows network stats
  • CPU states: shows CPU states and deep sleep
  • Processes: shows the cpu time (user and system) processes have consumed
  • Package info: shows rights and services for a given package (app): this view can be opened by clicking on any icon from any view:
These are the possible timespans

bbs6.png

  • Since charged: all statistics since the phone was 100% charged
  • Since unplugged: all statitics since the phone was unplugged from A/C or USB
  • Since custom reference: all statitics since a custom reference was set (from the "Actions" menu)
  • Since screen off: all statitics since the screen was turned off
  • Since boot: all statitics since the phone was booted

Please note that the data for the timespans gets deleted at boot. To use "Since unplugged" after a reboot you need to plug/unplug your phone.

OTHER

Group of different indicators about what is consuming the battery. This statistic should always be checked first as it gives a good idea about the draining profile.

bbs4.png

A usual profile would show low "Screen on" times compared the "Awake" meaning that partial wakelocks are resonsible for the battery drain as those preventing the phone from going to deep sleep.
  • Deep Sleep: the total time the phone was sleeping
  • Awake: the total time the phone was not in deep-sleep
  • Screen On: the total time the phone was awake and the display was on
  • Phone On: the total time the phone was in a call
  • Wifi On: the total time Wifi was on
  • Wifi Running: the total time Wifi was connected to a SSID
  • Bluetooth On: the total time bluetooth was on

PARTIAL WAKELOCKS

The list shows the total time of partial wakelock that was held by an application or by a service during the timespan, the number of wakelocks and the impact in percent. The impact in percent is calculated against the total time on, the awake time or the awake time - screen on time depending on the settings. Usually the impact calculated against the awake time is the most representative as it shows the potential in terms of reducing the awake time. The graph bars show the percentage depending on the preferences (see above).

bbs5.png

Even if the total time is low it is important to check for high counts as well. A large number of short wake periods can have a huge impact on the awake time as the phone takes some time to wake up and some time to go back to sleep. This is not shown in this stat. For example let's assume the phone takes 1/2 second to wake up and sleep again. For a wakelock of 10 seconds the resulting awake time would be 11 seconds. For 10 wakelocks of 0,1 seconds the total wakelock time would be as low as 1 second but the awake time would be 11 seconds.

Kernel WAKELOCKS

bbs7.png

Like for partial wakelocks as well long running wakelocks as wakelocks with a high count (large number of wakeups) should be taken into acount.

Alarms

Alarms are events created by applications that may cause wakeups.

Network

Shows the transfered Bytes per application and per network interface.

CPU States

Shows the time spent in each CPU state (frequency) including the time spent in deep sleep.

Processes

The list shows the processes and their CPU consumption during the timespan. CPU consumption is expressed in user CPU and system CPU and both times are shown in the total and in the bar graph with different colors.

MENU
  • Preferences
  • Refresh
  • Order By/li>
  • More
    • Dump to file: writes the statistics to /sdcard/BetterBatteryStats.log
    • Set Custom Reference: set a custom begin mark for a statitic
    • History: shows different graphs like battery usage or wakeups (starting from android 2.3)
    • Raw Alarms: shows the alarms since boot
    • Raw Kernel Wakelocks: shows the alarms since boot
    • Raw network stats: the network stats since boot
    • CPU states: the CPU states since boot
HOW TO

This provides an insight about how to use BetterBatteryStats to reduce the battery drain in a systematic manner.
First you must select a reference (most of the time "since unplugged" is the best way to start).

Go to the [Other] view

Check the deep sleep, awake and screen on times

The deep sleep to total time tells you how much time your phone has spent in the most power saving mode: ideally the deep sleep time should be near to the total time
The screen on vs. awake ratio tells you how much time your phone was in use vs. how long it has been awake. Ideally the screen on time should be equal to the awake time, meaning that the phone was only awake when in use.
Pro tip: the 1x1 widget shows both ratios and gives the best overview on how optimal your phones runs

Check the [Kernel wakelocks]

The list shows you what Kernel wakelocks occured: a symbol on the right shows that there is a knowledge-base article on that specific wakelock In the first step we want to check for high times (minutes or more), once there are no hot spots left we want to look at the high counts.

The PowerManagerService wakelock

This wakelock shows as a sum of the partial wakelocks on many phones. If this wakelock is #1 go to the Partial Wakelocks to find out more.

The multipdp / svnet-dormancy wakelock

This wakelock indicates a high network usage. If this wakelock is #1 go to the Network Stats to find out more.
If the PowerManagerService is not the highest wakelock check the online knowledge-base or use google search to find more information about the wakelock and its potential causes.

Check the [Partial wakelocks]

The list shows you what partial wakelocks occured and for most of them what application caused them. See "What's next" for more details on how to reduce them.

The AlarmManager wakelock

High times or count on the AlarmManager wakelock is a sign that either many wakeups were caused by alarms or that apps have added/modified alarms intensively. A detailed overview can be found under [Alarms].

The Network Stats

Here you will find what apps / packages are responsible for high data transfers.

What's next?

Some but not all wakelocks can be traced back to a specific app. In that case there are following options:

Check / change settings

Sometimes we really want the app / functionality causing the wakelocks and the good news is there is still hope. Many apps have settings that condition their behaviour so these should be checked:
  • frequency: having twitter check for new messages every 2 minutes is not something compatible with a long Battery Life. Once you know the cost of a functionality it may be easier to decide to use it on demand instead of let it running as a background scheduled task
  • quantity: check for optional services like e.g. cloud backup, full sync etc. and ask yourself if you really need all that stuff

Deinstall or freeze

Once a cause for partial wakelocks has been spotted you have to ask yourself if you even use that app. If not disable/deinstall/freeze it. Go back to the start and take another reading to see the effect of the action.
In some cases it is not possible to attribute a wakelock to an app. In such cases use the knowledge-base and google search to find more information about potential causes.

Common tips

Following tips can help you reducing some causes of awake:
  • Turn your GPS off when not required to avoid apps using that expensive location source
  • When you are finished using an app close it with the "back" button. This will terminate it and avoid background management
  • Don't use any auto killer apps. If there are apps you don't want to be started or cached freeze them or configure their auto-start properly
  • Don't use and power saving tools like Juice Defender or Green Power: most apps do not behave properly when they can't use the data connection and will generate overhead by trying
  • If you don't need Wifi turn it off: in some cases Wifi is known to cause wakeups and an overhead in e.g. location services

Enjoy your successes

One basic rule in performance optimization is to check the results for each action taken and this applies here too:
  • don't make too many changes at once: once a hot spot has been removed you may have a completely different picture. This is why processing two or more findings at once may be a waste of time
  • switching Kernel, ROM or modem during a round of optimization will probably distort your statistics, avoid running tests during this time as the results may be demotivating
  • consider external factors, in case of unexpected stats being reported by BBS, run the tests again to validate readings: our phones are not closed systems and conditions like network coverage may influence readings. In case of doubt, confirm results by repeating the readings under different conditions in order to correctly diagnose a problem
  • don't obsess: you want to enjoy your phone too so don't obsess by hunting down the last second of wakelock. Enjoy your results!
credits: Sven Knipsel
edited by: arawn
Nov 15, 2012