Battery Historian 2.0 for windows环境搭建
来源:互联网 发布:fdd网络 编辑:程序博客网 时间:2024/06/05 20:12
简介
Battery Historian 1.0 通过python脚本转换成html文件,命令如下:
python historian.py -a bugreport.txt > battery.html
在Google I/O 15 中 Battery Historian 新版本 Battery Historian 2.0 发布了,新版本带来了很多的改进:更清晰的报告,每个应用程序的摘要,更快的执行等等。虽然新功能真的很棒,但是Battery Historian的安装变得更加的复杂了,因为它增加了很多的依赖,并且它所有的文档跟脚本都是用于Linux及Mac OS上的。所以特别写了这篇Battery Historian 2.0 在windows环境下的搭建。
步骤
安装依赖项
- Git
- python 主要是为了1.0版本的查看
- Go Battery Historian 2.0使用了Go语言进行了重写。所以你首先需要下载并安装它。Go 下载 并且创建一个Go的工作空间 如:mkdir E:\GoProject
安装Battery Historian 2.0
打开cmd,配置Go的环境变量,并进入Go工作空间
set GOPATH=E\\go-workspaceset GOBIN=D:\\Go\\binset PATH=%PATH%;%GOBIN%cd %GOPATH%
获取go的一些依赖如:proto,protoc-gen-go 以及 Battery Historian,命令如下
go get -u github.com/golang/protobuf/protogo get -u github.com/golang/protobuf/protoc-gen-gogo get -u github.com/google/battery-historian
进入 %GOPATH%\src\github.com\google\battery-historian 新建两个目录:third_party 以及compiled. 下载 Closure compiler 并解压到 third_party\closure-compiler。结果如下:
Clone closure library 到 third_party\closure-library目录下
git clone https://github.com/google/closure-library third_party/closure-library
下来我们还需要修改 battery-historian\analyzer\analyzer.go 内的代码
- cmd := exec.Command("./historian.py", "-c", "-m", "-r", reportName, filepath)+ cmd := exec.Command("C:\\Python27\\python.exe", "./historian.py", "-c", "-m", "-r", reportName, filepath)
最后我们需要在battery-historian 执行两句命令来完成Battery Historian 2.0 的安装
third_party\closure-library\closure\bin\build\depswriter.py --root="third_party\closure-library\closure\goog" --root_with_prefix="js ../../../../js" > compiled\historian_deps-runfiles.jsjava -jar third_party\closure-compiler\compiler.jar --closure_entry_point historian.Historian --js js\*.js --js third_party\closure-library\closure\goog\base.js --js third_party\closure-library\closure\goog\** --only_closure_dependencies --generate_exports --js_output_file compiled\historian-optimized.js --compilation_level SIMPLE_OPTIMIZATIONS
PS:如下执行上面代码时候出现错误可查看Setup broken #42 删除目录下的html文件即可以解决问题了。
运行Battery Historian 2.0
现在已经完成了整个安装步骤了,通过下面的命令即可运行Battery Historian了。set GOPATH=E:\\GoProjectcd %GOPATH%\src\github.com\google\battery-historian\E:go run cmd\battery-historian\battery-historian.gopause
可以将上面的命令作为批处理保存,运行结果如下:
访问 http://localhost:9999 你就能看到你的 Battery Historian 2.0 本地运行的情况了:
好我们看看运行的报告结果吧。
参考文档
Getting Battery Historian 2.0 to work on Windows
- Battery Historian 2.0 for windows环境搭建
- Battery Historian for windows环境搭建
- Battery Historian for windows环境搭建
- battery historian windows环境搭建
- Android电量测试之battery-historian V2.0 Windows环境搭建
- Android battery historian功耗分析之环境搭建
- battery-historian工具环境部署及使用
- Battery-historian 2.0的安装与使用
- Battery Historian工具
- Battery-Historian基本参数介绍
- 电量优化之Battery Historian
- battery-historian工具的使用
- gcc for windows 环境搭建
- 【android】环境搭建(For Windows)
- kinect for windows - 环境搭建
- appium for windows 环境搭建
- appium for windows 环境搭建
- appium for windows 环境搭建
- apache2.2修改服务可执行路径
- C++ delete陷阱
- Mac OS 安装Wget
- Application.Run() form.show form.showdialog
- logcat日志自动消失
- Battery Historian 2.0 for windows环境搭建
- JS中的“!!”
- 数据结构(寒假小结)——2.1线性表之顺序表
- c——字符数组
- 灰色预测模型
- IOS安全–使用class-dump-z导出IOS应用类信息
- UItextView 换行回收键盘
- 通过链接添加新的tab页
- 全屏视频播放