电量优化之Battery Historian
2016-04-21 14:56
351 查看
电量的监测是一件很麻烦的事情,但是这件事在5.0以上手机将会轻松获得,下面就为大家介绍下google官方提供的工具,Battery Historizan。
官方文档见下:http://developer.android.com/tools/performance/batterystats-battery-historian/index.html
在官方文档中,为我们提供了2种方法,我们采用以下这种,因为它可以更加清晰的展示各个App的使用电量情况,网络发包情况,Cpu 使用,屏幕唤醒等等情况。
文档见下:https://github.com/google/battery-historian
If you are new to the Go programming language:
Follow the instructions available at http://golang.org/doc/install for downloading and
installing the Go compilers, tools, and libraries.
Create a workspace directory according to the instructions at http://golang.org/doc/code.html#Organization.
Ensure that
variables are appropriately set and added to your
For Windows, you may set environment variables through the "Environment Variables" button on the "Advanced" tab of the "System" control panel. Some versions of Windows provide this control panel through the "Advanced System Settings" option inside
the "System" control panel.
For Linux and Mac OS X, you can add the following lines to your ~/.bashrc or ~/.profile files (assuming your workspace is $HOME/work):
Next, install Git from https://git-scm.com/downloads if it's not already installed.
Next, make sure Python 2.7 (NOT Python 3!) is installed. See https://python.org/downloads if it isn't,
and ensure that python is added to your
Next, install Java from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Next, download the Battery Historian code and its dependencies:
Finally, run Battery Historian!
Remember, you must always run battery-historian from inside the
To take a bug report from your Android device, you will need to enable USB debugging under
On Android 4.2 and higher, the Developer options screen is hidden by default. You can enable this by following the instructions here.
To obtain a bug report from your development device:
You are all set now. Run
upload the
现在,我对英文说明简要的解释下:
1.首先要去官网下载软件,并安装
2.在你的目录中创建文件夹,如goworkspace,其中该文件夹包含3个子文件夹,src,bin,pkg。
3.配置环境变量 ,我用的是mac电脑。
查看你的go 是否安装成功,在终端输入命令行。go version ,会看到
go version go1.6.1 darwin/amd64
将路径配置到环境变量,输入open -e .bash_profile
,
export GOPATH=/Users/cccc/goworkspace (输入go workspace的路径)
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
然后关闭编辑,保存source ~/.bash_profile
4.查看你的go 的环境是否配置成功
输入 go env
5. 安装git
6. 安装python ,make
sure Python 2.7 (NOT Python 3!)
输入whereas
python ,查看安装地址
python
version,查看版本。
7.如果以上步骤都成功,恭喜你马上就可以看到了
download
the Battery Historian code and its dependencies:
8.Finally, run Battery Historian!
9.
adb shell dumpsys batterystats —reset
10.断开手机,使用App
11.adb
bugreport > bugreport.txt
12.打开 网页http://localhost:9999
13.上传bugreport.txt,然后选择你要查看的App
官方文档见下:http://developer.android.com/tools/performance/batterystats-battery-historian/index.html
在官方文档中,为我们提供了2种方法,我们采用以下这种,因为它可以更加清晰的展示各个App的使用电量情况,网络发包情况,Cpu 使用,屏幕唤醒等等情况。
文档见下:https://github.com/google/battery-historian
If you are new to the Go programming language:
Follow the instructions available at http://golang.org/doc/install for downloading and
installing the Go compilers, tools, and libraries.
Create a workspace directory according to the instructions at http://golang.org/doc/code.html#Organization.
Ensure that
GOPATHand
GOBINenvironment
variables are appropriately set and added to your
$PATHenvironment variable.
$GOBIN should be set to $GOPATH/bin.
For Windows, you may set environment variables through the "Environment Variables" button on the "Advanced" tab of the "System" control panel. Some versions of Windows provide this control panel through the "Advanced System Settings" option inside
the "System" control panel.
For Linux and Mac OS X, you can add the following lines to your ~/.bashrc or ~/.profile files (assuming your workspace is $HOME/work):
export GOPATH=$HOME/work export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN
Next, install Git from https://git-scm.com/downloads if it's not already installed.
Next, make sure Python 2.7 (NOT Python 3!) is installed. See https://python.org/downloads if it isn't,
and ensure that python is added to your
$PATHenvironment variable.
Next, install Java from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Next, download the Battery Historian code and its dependencies:
$ go get -d -u github.com/google/battery-historian/...
Finally, run Battery Historian!
$ cd $GOPATH/src/github.com/google/battery-historian # Compile Javascript files using the Closure compiler $ go run setup.go # Run Historian on your machine (make sure $PATH contains $GOBIN) $ go run cmd/battery-historian/battery-historian.go [--port <default:9999>]
Remember, you must always run battery-historian from inside the
$GOPATH/src/github.com/google/battery-historiandirectory:
cd $GOPATH/src/github.com/google/battery-historian go run cmd/battery-historian/battery-historian.go [--port <default:9999>]
How
to take a bug report
To take a bug report from your Android device, you will need to enable USB debugging under Settings > System > Developer Options.
On Android 4.2 and higher, the Developer options screen is hidden by default. You can enable this by following the instructions here.
To obtain a bug report from your development device:
$ adb bugreport > bugreport.txt
Start
analyzing!
You are all set now. Run historianand visit http://localhost:9999 and
upload the
bugreport.txtfile to start analyzing.
现在,我对英文说明简要的解释下:
1.首先要去官网下载软件,并安装
2.在你的目录中创建文件夹,如goworkspace,其中该文件夹包含3个子文件夹,src,bin,pkg。
3.配置环境变量 ,我用的是mac电脑。
查看你的go 是否安装成功,在终端输入命令行。go version ,会看到
go version go1.6.1 darwin/amd64
将路径配置到环境变量,输入open -e .bash_profile
,
export GOPATH=/Users/cccc/goworkspace (输入go workspace的路径)
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
然后关闭编辑,保存source ~/.bash_profile
4.查看你的go 的环境是否配置成功
输入 go env
5. 安装git
6. 安装python ,make
sure Python 2.7 (NOT Python 3!)
输入whereas
python ,查看安装地址
python
version,查看版本。
7.如果以上步骤都成功,恭喜你马上就可以看到了
download
the Battery Historian code and its dependencies:
$ go get -d -u github.com/google/battery-historian/...
8.Finally, run Battery Historian!
$ cd $GOPATH/src/github.com/google/battery-historian # Compile Javascript files using the Closure compiler $ go run setup.go # Run Historian on your machine (make sure $PATH contains $GOBIN) $ go run cmd/battery-historian/battery-historian.go [--port <default:9999>]
9.
adb shell dumpsys batterystats —reset
10.断开手机,使用App
11.adb
bugreport > bugreport.txt
12.打开 网页http://localhost:9999
13.上传bugreport.txt,然后选择你要查看的App
相关文章推荐
- 10个常用Jquery代码片段
- 0027-日志
- SpringMVC注解@Autowired和@Qualifier 自动注入[根据类型注入] @Autowired 可以对成员变量、方法以及构造函数进行注释, @Qualifier 的
- JavaScript的瀑布流效果的详解及实现
- Netty
- Android 使用UncaughtExceptionHandler 类捕抓异常信息
- shell命令
- C#基础知识之List的使用
- 使用key in arr遍历数组
- 谷歌招聘机制
- word2007怎么从第三页开始设置页码
- IE6 7 8BUG锦集
- Linux下配置静态IP地址,设置DNS和主机名
- BASE64
- Map的循环
- 如何在FTP服务器上传和下载文件
- oracle instr 函数的使用
- Java Map和Bean相互转换
- 腾讯公司运维面试题
- Java Map和Bean相互转换