Battery Historian之App耗電量測試

1、Battery Historian測試所需環境:Go+Git+Python+Java+Battery Historian源碼git

下載Battery Historian源碼而且運行的步驟以下:github

1.打開Git Bash 輸入命令行go get -d -u github.com/google/battery-historian/...    (注意:命令後面有三個點)shell

2.進入到$GOPATH/src/github.com/google/battery-historian目錄下方瀏覽器

3.運行Battery Historian,命令:go run setup.goapp

 

2、打開瀏覽器,訪問地址
http://localhost:9999/測試

3、生成adb採集日誌文件txt, 執行步驟
1.adb shell dumpsys batterystats --enable full-wake-history
2.adb shell dumpsys batterystats --reset
3.拔出USB
4.執行測試用例
5.adb bugreport > filename.txt
6.adb shell dumpsys batterystats --disable full-wake-historygoogle

4、將filename.txt文件上傳到http://localhost:9999/ 的「Power Monitor File」 提交後會自動分析命令行

5、關注Battery Level 曲線,在app Selection選擇測試的app,在右側查看App Stats,關注如下指標值日誌

    --Devices estimated power useblog

    --Foreground

    --Services下方的相關進程

    --Process info

相關文章
相關標籤/搜索