android 电量分析工具

1、参考文章:https://developer.android.com/studio/profile/battery-historian.html

这篇文章讲的是如果dump 电量日子文件batterystats.txt,然后使用historian.py将其转化为html文件,让开发者更直接多了解其中信息。
但是historian已经升级到2.0了,不在使用python来做数据分析,而是直接使用Go语言实现的。

例如:上文中提到的https://github.com/google/battery-historian 上的项目已经更新了,找不到该python脚本。
2、按照github上那个开源项目的介绍,安装该工程。

3、adb shell dumpsys batterystats --reset 这里如果不如此,后续dump的文件会过大

4、然后锻炼PC和手机的链接,使用自己的App一段时间,可以切换到桌面等

5、再次链接手机

6、
$ adb bugreport > bugreport.txt

7、
$ go run cmd/battery-historian/battery-historian.go [--port <default:9999>],安装github上面的介绍,启动服务

8、在网页上,上传bugreport.txt 文件,即可以看到分析结果。

 

 

 

原文地址:https://www.cnblogs.com/lipeil/p/5813431.html