BatteryHistorian环境配置
-
1.Go语言环境配置
1.下载安装(go1.8.windows-amd64.msi)
https://studygolang.com/dl 官方(https://golang.org/doc/install#testing)
2.配置环境变量
C:\Go\bin; -
2.Python环境配置
1.下载安装(Python2.7)
https://www.python.org/downloads/
2.配置Python环境变量
C:\Python27; -
3.Git环境配置
-
4.JAVA环境配置
-
5.下载Battery historian源码并且运行
1、在E:\GoProject目录下运行git bashhere
2、输入命令行go get -d -u github.com/google/battery-historian/
3、进入到$GOPATH/src/github.com/google/battery-historian目录下方
4、执行go run setup.go下载代码
需翻墙下载最好,不然可能下载不成功,可以手动下载,从 setup.go文件中可以找到下载地址
a. http://dl.google.com/closure-compiler/compiler-20160208.zip
b. https://github.com/google/closure-library
c. https://github.com/xuanluo/flot-axislabels.git
或: 链接:https://pan.baidu.com/s/1fpVS6KJu_rd4yK2axAXW5Q
提取码:aghg
https://github.com/google/battery-historian
下载完成后,在 ~/go/src/github.com/google/battery-historian 路径下执行 go run cmd/battery-historian/battery-historian.go
(监听端口为9999的localhost地址)
这个时候就可以在网页中打开 http://localhost:9999/ 上传如下方式所获取到的电池数据日志
- 重置电池数据
adb shell dumpsys batterystats --enable full-wake-history
adb shell dumpsys batterystats --reset
- 获取电池数据
adb bugreport bugreport.zip // 6.0之前执行 adb bugreport > bugreport.txt
// 或者
adb shell dumpsys batterystats > batterystats.txt
// 生成的文件为: bugreport-NMF26X-2017-09-26-09-17-09.zip
运行效果图:
Timeline:
System stats: