本文主要分析了Android平板电量数据采集以及如何使用Battery Historian进行电量问题分析
1.battery historian平台搭建
1)安装battery historian最简单是通过Docker进行安装,本文主要介绍自行编译源码实现,主要参考 https://github.com/google/battery-historian/
2)安装Go语言环境,
1>配置GOROOT为C:\go;就是go的安装路径
2>在PATH变量里配置go安装目录下的bin目录,即C:\go\bin。也可以引用GOROOT变量,如%GOROOT%\bin,配置了该值后才能直接执行go相关的命令。
3>配置GOPATH:Go的工作目录,本文为C:\workspace,使用go命令拉取git源代码仓库会自动后去到本目录


3)安装python环境

4)安装git:git应该都有的吧:)
5)拉取 battery-historian 源代码
拉取一下电量分析源代码:go get -d -u github.com/google/battery-historian 成功之后出现在:src/github.com/google/battery-historian
需要protobuf-go这个版本:https://github.com/protocolbuffers/protobuf-go/ 自行修改下目录 src/google.golang.org/protobuf

6)进行编译
$ cd $GOPATH/src/github.com/google/battery-historian
# Compile Javascript files using the Closure compiler
$ go run setup.go
7) third_party下有3个git仓库,从下边进行获取
closure-library : https://github.com/google/closure-library/releases/tag/v20161201
flot-axislabels : git上搜索一下或是gitee上查一个也行
closure-compiler:同上
8)编译项目
cd $GOPATH/src/github.com/google/battery-historian(注意cd到目录即可,不然会出现一点问题)
go run cmd/battery-historian/battery-historian.go [--port <default:9999>]
9) 访问http://localhost:9999
