码迷,mamicode.com
首页 > Windows程序 > 详细

Battery Historian for windows环境搭建

时间:2016-07-06 20:08:04      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:

Battery Historian for windows环境搭建

简介:Battery historian是一款通过上传bugreport文件分析用户手机中App的电池耗电情况的工具。

Battery Historian 1.0 通过python脚本转换成html文件,而新版本 Battery Historian 2.0 发布了,新版本带来了很多的改进:更清晰的报告,每个应用程序的摘要,更快的执行等等。

 

步骤

一、首先安装Go编程语言

  1. 点击下载【下载】;
  2. 安装Go;
    技术分享
  3. 配置GOROOT和GOPATH

    a. GOROOT的作用是告诉Go 命令和其他相关工具,在哪里去找到安装在你系统上的Go包,所以这里配置的是GO的安装目录

     技术分享

 

    b.GOPATH可以简单理解为是工程的目录,所以创建一个GO的工程路径

     技术分享

 

         C.最后配置一下环境变量,把Go的bin目录放到path环境变量中

     技术分享

 

  4. 检查Go是否安装成功,打开命令行输入Go version

   技术分享

 

二、安装Git

  1. 点击下载【下载】;
  2. 按照步骤安装;
  3. 安装完成检查:命令行输入git version

   技术分享

   也可以直接打开git bash检查

   技术分享

 

三、安装Python

  1. 点击下载【下载】,注意仅支持python2.7
  2. 安装完成;
  3. 环境变量配置,添加Path的路径,是Python的安装路径
    技术分享
  4. 输入命令行 python –V(注意是大写V)检查是否安装成功

     技术分享

 

四、安装Java环境

  1. 点击下载【下载】;
  2. 完成安装。

 

五、下载Battery Historian源码并且运行

  1. 输入命令行go get -d -u github.com/google/battery-historian/..

     技术分享

     **下载到GOPATH配置目录下

  2. 进入到$GOPATH/src/github.com/google/battery-historian目录下方
    技术分享
  3. 运行Battery Historian

    a. go run setup.go

    # Compile Javascript files using the Closure compiler

    $ go run setup.go
    技术分享

    等待数分钟或者10分钟左右,如果仍然没有下载成功,可以手动下载,如下操作

    **下载【closure-library】和【closure-compiler】和【flot-axislabels】,解压放到GOROOT目录下third_party文件夹下方的的closure-compiler和closure-library和flot-axislabels文件夹 ../battery-historian\third_party;如果没有均手动创建

     技术分享

    b. go run cmd/battery-historian/battery-historian.go

    # Run Historian on your machine (make sure $PATH contains $GOBIN)

    $ go run cmd/battery-historian/battery-historian.go [--port <default:9999>]

  4. 检查/battery-historian是否运行,登录网址 http://localhost:9999查看

六、导出手机的Bugreport日志

1.输入指令 adb bugreport > bugreport.txt导出。

 

七、上传bugreport.txt文件至 http://localhost:9999

  1. 上传bug日志
    技术分享

  2. 查看结果
    技术分享

 

 

 

参考资料:

https://github.com/google/battery-historian#wakelock-analysis

Battery Historian for windows环境搭建

标签:

原文地址:http://www.cnblogs.com/jytian/p/5647798.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!