Battery Historian 2.0 for windows环境搭建
2016-01-25 19:38
399 查看
简介
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-workspace set GOBIN=D:\\Go\\bin set PATH=%PATH%;%GOBIN% cd %GOPATH%
获取go的一些依赖如:proto,protoc-gen-go 以及 Battery Historian,命令如下
go get -u github.com/golang/protobuf/proto go get -u github.com/golang/protobuf/protoc-gen-go go 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.js java -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:\\GoProject cd %GOPATH%\src\github.com\google\battery-historian\ E: go run cmd\battery-historian\battery-historian.go pause
可以将上面的命令作为批处理保存,运行结果如下:
访问 http://localhost:9999 你就能看到你的 Battery Historian 2.0 本地运行的情况了:
好我们看看运行的报告结果吧。
参考文档
Getting Battery Historian 2.0 to work on Windows相关文章推荐
- UVa 280 - Vertex
- codeforces D. Area of Two Circles' Intersection 计算几何
- Struts2之文件上传
- 编程日常
- C++ delete陷阱
- ios在移动动画过程中响应触摸
- Top Things to do After Installing Ubuntu 13.04 Raring Ringtail
- 【线段树】线段树入门之入门
- DeepLearningToolBox学习——RBM(Restrict Boltzmann Machine)II
- ARM64 Linux的启动分析
- The Java™ Tutorials — Generics :Why Use Generics? 为什么使用泛型
- VMWare+CentOs7+hadoop+hbase 安装
- Tomcat启动分析(Tomcat7.0)
- suricata的ips模式
- Ajax动态载入xml文件内容
- Android源码之Matrix
- suricata安装配置
- Happy Number
- 1,Java的移位操作效果; 2,移位如何实施的; 3, 原码补码反码原理
- KVC与KVO