Monday, March 17, 2014

Donate Bitcoins

BetterBatteryStats [APP][2.1+][24 Nov. - V1.15]

I wrote BetterBatteryStats because I was missing the great battery history that Spare Parts allowed to call on Froyo:
- General "other stats "overview: Awake, Deep Sleep, Screen On, Phone On, Wifi On, Wifi Running ratios
- Kernel Wakelocks
- Partial wakelocks
- Alarms/Wakeups
- CPU States
- Network stats
- Process stats with User and System CPU time


BetterBatteryStats is calling the "batteryinfo" service of Android to retrieve data already lying there without generating overhead.

BetterBatteryStats is focussing and has been tested on Froyo, Gingerbread, Honeycomb (3.1, thanks to daveid), ICS, JB and Kitkat on different ROMs and Kernels. 

What are wakelocks and why should you care about them?
When it comes to Android the most discussed and commented topic that I know is battery drain / battery life. I'm a quite heavy user because I spend a lot of time on the train every day reading my mails, surfing and listening to music but still my phone is off for a long time during the day and while I accept the battery being drained while I use the phone I care about it draining slowly while "doing nothing".


Wakelocks or to be more precise partial wakelocks is a pattern (in fast a class) than helps devs to make sure that important pieces of their code do not get interrupted.
Basically the phone has (simplified, kernel devs don't shoot) three states:
1. awake with screen on
2. awake
3. sleeping (that's you phone favorite state)

The transitions are from (1) to (2) and finally from (2) to (3). Now as long as you use your phone it's in (1) and does not leave that state as long as you keep using it interactively. If you stop using it the phone is aiming to go to (3) as fast as possible.
And here's where wakelocks are important: as our phones as smartphones they tend to do background processing. Some of this processing is important like e.g. making a phone call, listening to music or synchronizing your contacts.
As the phone wants to go from (2) to (3) and on the other hand you don't want to hang up while you are in a call the app keeps hold of a wakelock to prevent that transisiton. When you hang up the partial wakelock gets release and here we go (the phone goes to sleep).

So partial wakelocks is a tool and it's not something that we should forbid for obvious reasons. Now there are cases when the design on an app is not real life proven (conditions of poor of no converage) and the wakelocks have negative effects because they are held unnecessarily or for too long.
BetterBatteryStats identifies these wakelocks and using your expertise or the once from our users here you can understand what happens and find a strategy to change that for the better.

Try it yourself

If you need help
Always add the whole context when asking for help. Most of the times a dumpfile is helpful, sometimes screenshots showing your observations may help as well.

Before posting a dump please make sure that the references for kernel wakelocks and alarms were processed correctly. Reading a dump takes a few minutes and it would be great if you could not waste the time of whowver studies in, aiming at helping you.
Generally a dump "since unplugged" is better than "since charged". When you start your analysis make sure to follow following procedure:
- plug/unplug the charger
- leave the phone alone 1-4 hours
- save a dump and check that the chapters "Kernel wakelocks" and "alarms" (if you have root) are populated
- Post the dump as attachement

I will not reply to posts with incomplete dumps

Reporting bugs
If you want to report a bug please make sure:
- that you can reproduce the problem
- explain what the problem is, how you could reproduce it and what is going wrong (a sentence lke "xxxx does not work for me" is a waste of your time and wil be ignored)
- enable debug in advanced prefernces
- post a logcat

good read about reporting bugs

Thanks
To nobnut for donating me a Nexus S for testing 
To nobnut and brandall for their support, encouragements, testing and constructive feedback in the early stages of the development.
To @cri for the new icons / logo

To suku_patel_22, jeremysherriff, Karpfenhai, Tungstwenty, It_ler, Perseus71 and mag01 for their help in this thread and their systematic testing my betas and RCs

To Entropy512 for providing support and insights about kernel wakelocks and helping making BBS a better tool


BetterBatteryStats is available on the Android market (https://market.android.com/details?i...erbatterystats) for what I believe is a fair price.

Download:
BetterBatteryStats_xdaedition_1.16.0.0_B2.apk

App by XDA-Developer chamonix

No comments:

Post a Comment

Bitcoin

Contributors

Created and designed by © Faruhaan