App battery Test Battery historian Introduction

Source: Internet
Author: User

Battery Historian

The battery historian is a tool for detecting battery-related information and events, running on Android 5.0 Lollipop (API level 21) and beyond. It generates a sheet with time coordinates, and the user can view the power consumption time of various events.


Installation

First, install the Go programming language

    1. Click to download "Download";

    2. Install go;
      650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180823467-562681340. PNG "style=" margin:0px;padding:0px;border:0px; "/>

    3. Configuring Goroot and Gopath

A. The role of Goroot is to tell the GO command and other related tools where to find the go package installed on your system, so here is the Go installation directory

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180833702-789515339. PNG "style=" margin:0px;padding:0px;border:0px; "/>

B.gopath can be simply understood as a catalog of works, so create a Go project path

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180839827-211565793. PNG "style=" margin:0px;padding:0px;border:0px; "/>

C. Finally configure the environment variables, put the Go bin directory in the PATH environment variable

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180845858-535860683. PNG "style=" margin:0px;padding:0px;border:0px; "/>

4. Check if go installs successfully, open command line input go version

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180904702-716357464. PNG "style=" margin:0px;padding:0px;border:0px; "/>

Second, install Git

    1. Click to download "Download";

    2. Follow the steps to install;

    3. Install complete check: command line input git version

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180925686-692698366. PNG "style=" margin:0px;padding:0px;border:0px; "/>

You can also open the Git bash check directly

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180931546-649410115. PNG "style=" margin:0px;padding:0px;border:0px; "/>

Third, install Python

    1. Click to download "Download", note only support python2.7

    2. Installation completed;

    3. environment variable configuration, add path, is the path of Python installation
      650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180942764-639467442. PNG "style=" margin:0px;padding:0px;border:0px; "/>

    4. Enter command line PYTHON–V (note is capital V) to check whether the installation was successful

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180946467-399816609. PNG "style=" margin:0px;padding:0px;border:0px; "/>

Iv. installation of the Java environment

    1. Click to download "Download";

    2. Complete the installation.

V. Download battery historian source code and run

  1. Git directory click Git-bash.exe, enter command line go get-d-u github.com/google/battery-historian/...

    650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706180958358-2120136445. PNG "style=" margin:0px;padding:0px;border:0px; "/>

    * * Download to the Gopath configuration directory

  2. Enter below the $gopath/src/github.com/google/battery-historian directory
    650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706181004046-893847655. PNG "style=" margin:0px;padding:0px;border:0px; "/>

  3. Run Battery Historian

    Enter $ go Run setup.go

    # Compile Javascript files using the Closure compiler


    650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706181016858-77416469. PNG "style=" margin:0px;padding:0px;border:0px; "/>

    Wait a few minutes, if the download is still not successful, you can manually download the following actions

    * * Download "closure-library" and "Closure-compiler" and "Flot-axislabels", unzip and put into Goroot directory Third_ The Closure-compiler and closure-library and Flot-axislabels folders below the Party folder: /battery-historian\third_party, if not all manually created

    650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/878293/201607/878293-20160706181023780-1157748671. PNG "style=" margin:0px;padding:0px;border:0px; "/>

    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. Check if/battery-historian is running, login URL http://localhost:9999 view



Generate Bugreport

First, data preparation

1.windows cmd execute the following command to turn on battery data acquisition

adb shell Dumpsys batterystats--enable full-wake-history

2.windows cmd perform the following command to reset the battery data

adb shell Dumpsys batterystats--reset


Second, operation application, generate Bugreport

Unplug the USB, and then the test app to do the relevant operation, after a period of time, plug in the USB, run two commands.

1.windows CMD executes the following command to save the Bugreport information to the appropriate path, waiting for execution to complete

ADB bugreport > Bugreport.txt

2.windows cmd execute the following command to convert the above TXT document into an HTML file

Python historian.py-a bugreport.txt >battery.html

Note: Now do not know why the prompt error, can not find historian.py this file

The above historian.py is a script written in Python, so you need a Python environment that can be downloaded from GitHub, and when the above commands are executed, you will find two files, Bugreport.txt and battery.html, this time with Google Browser input http://localhost:9999, Upload bugreport.txt or you can open battery.html directly, the view is as follows:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/87/F9/wKioL1fl9AeQ3KpCAAJe6GELMx0677.png-wh_500x0-wm_3 -wmp_4-s_1217342203.png "title=" qq picture 20160924112509.png "alt=" Wkiol1fl9aeq3kpcaaje6gelmx0677.png-wh_50 "/>


The above is V2.0 version, you can switch to version 1, now to analyze the meaning of the various parameters:

V2.0 the indicator more, because there is no corresponding reference document, ask the relevant big God later. So we can only analyze the V1.0 first, may refer to http://blog.csdn.net/itfootball/article/details/44084159


Finally, we can also see the amount of power (estimated) that the process is consuming:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/87/F9/wKioL1fmChawJuHRAAFW6YjkpoA922.png-wh_500x0-wm_3 -wmp_4-s_1793137267.png "title=" Qq20160924130718.png "alt=" Wkiol1fmchawjuhraafw6yjkpoa922.png-wh_50 "/>


App battery Test Battery historian Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.