Power consumption test
are divided into two types:
1) A specific value for direct testing of power consumption over a period of time
2) indirect testing and consumption-related data or scenarios, so that through testing and optimization, the same can be achieved to reduce the power consumption of the effect
Use the Dumpsys command to view the application's wakelock mechanism and the running state of the services it owns.
Adb-s <device number> Shell Dumpsys batteryinfo <package name>
By filtering your application's corresponding package name, you can see some of the following data.
NETWORK:200KB received, 300KB sent
Wake lock xxx:40s (200times) Realtime
Wake lock Xxx:29min (2 times) Realtime
...
Proc XXX
cpu:10s 850ms usr+2s 990ms KRN
Service XXX:
Created for:xxx Uptime
starts:0, launches:0
Service XXX:
Created for:xxx Uptime
Starts:11, launches:22
...
See the information behind Wake Lock primarily.
The power consumption information of each component in the phone can be found in the Power_profile.xml file.
Use of Battery-historian Tools
A very powerful open source tool that installs:
Https://github.com/google/battery-historian
Big talk App Test 2.0 notes 2