I am testing a mobile app , as part of non functional validaiton i need to check its battery drain. Based on few internet searches i found a way to do that
1. dump the battery stats via
adb shell dumpsys batterystats
2. Search for my app UID, at the beginning of test and end of test and take the difference and I believe the difference will the amount of mah consumed by my app
eg:
UID u0a273: 47.9 bg: 0.00496 cached: 0.0000140 (8s 819ms)
screen=47.9 cpu=0.00497 cpu:bg=0.00496 cpu:cached=0.0000140
(on battery, screen on) screen=47.9 cpu=0.00497 cpu:bg=0.00496 cpu:cached=0.0000140
In this I believe the value UID u0a273: 47.9
is my battery consumption value
Asked by Deepak
(21 rep)
Aug 14, 2025, 02:25 PM
Last activity: Aug 14, 2025, 03:41 PM
Last activity: Aug 14, 2025, 03:41 PM