zoukankan      html  css  js  c++  java
  • webtest mobile + Android / Battery Historian / SoloPi

    s

    battery-historian 使用方法

    https://www.cnblogs.com/jiablogs/p/8891586.html

    battery-historian

    /opt/files/go/src/github.com/google/battery-historian

    重置电量命令:

    adb shell dumpsys batterystats --reset

    重启设备命令:

    adb reboot

    获得详细的唤醒锁数据

    adb shell dumpsys batterystats –enable full-wake-history 注意:由于记录所有唤醒锁数据会导致日志数量超过上限(50M),因此最好在分析具体应用时使用上述操作,并在完成后执行 adb shell dumpsys batterystats –disable full-wake-history,否则,导出的bugreport由于太大而无法解析。

    工具使用方法:
    1.运行工具

    cd c:/user/battery-historian(battery-historian放置的路径)

    go run setup.go

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

    2.导出bugreport

    adb bugreport>bugreport.txt(可新建文本文档,拖动到该位置)

    3.导入bugreport.txt

    在google chrome中输入:http://localhost:9999,然后导入bugreport.txt

    4.开始分析

    各个参数的意义:

    CPU runing: cpu运行的状态

    Kernel only uptime: 只有kernell运行?

    Userspace wakelock: 用户空间申请的锁

    Screen: 屏幕是否点亮

    Top app: 当前在内存中的应用,按内存占用率排序

    Activity Manager Proc: 活跃的用户进程

    Crashes(logcat): 某个时间点出现crash的应用

    Doze: 是否进入doze模式 Device

    active: 和Doze相反

    JobScheduler: 异步作业调度

    SyncManager: 同步操作

    Temp White List: 电量优化白名单

    Phone call: 是否打电话

    GPS: 是否使用GPS

    Network connectivity: 网络连接状态(wifi、mobile是否连接)

    Mobile signal strength: 移动信号强度(greatgoodmoderatepoor)

    Wifi scan: 是否在扫描wifi信号

    Wifi supplicant: 是否有wifi请求

    Wifi radio: 是否正在通过wifi传输数据

    Wifi signal strength: wifi信号强度

    Wifi running: wifi组件是否在工作(未传输数据)

    Wifi on: 同上

    Audio: 音频子系统?

    Camera: 相机是否在工作

    Video:是否在播放视频

    Foreground process: 前台进程

    Package install: 是否在进行包安装

    Package active: 包管理在工作

    Battery level: 电池当前电量

    Temperature: 电池温度

    Plugged: 连接usb或者充电

    Charging on: 在充电

    Logcat misc: 是否在导出日志

    电量分析工具 Battery Historian 的配置及使用

    https://www.cnblogs.com/yinrw/p/9621109.html

    电量分析工具 Battery Historian 的配置及使用

     

    1、Building from source code(通过各种配置后从源码构建)

    官方流程看似很麻烦,但一上手,很快就搞定,让我情何以堪。

    ps:以下均是参考官方及网友做的 copy 
    https://github.com/google/battery-historian#building-from-source-code 
    http://blog.csdn.net/feitian_666/article/details/52756522 
    http://blog.csdn.net/feitian_666/article/details/52756522

    (1)安装 Go 语言

    这里写图片描述
    这里写图片描述
    这里写图片描述
    • 检查是否安装成功:cmd 执行 “go version”
    这里写图片描述

    (2)安装 Python

    • 下载:https://www.python.org/ 【注意仅支持 python 2.7,python3.0改变很大】
    • 安装
    • 配置环境变量 

      这里写图片描述
    • 检查是否安装成功:cmd 执行 “python –V”【注意是大写V】

    这里写图片描述

    (3)安装Git

    这里写图片描述

    (4)安装 Java 环境(JDK)

    • 别跟我说你没有 …

    (5)下载 Battery Historian 源码并且运行

    • cmd 执行“go get -d -u github.com/google/battery-historian/…”【注意最后有三个点】
    这里写图片描述
    • 进入到“$GOPATH/src/github.com/google/battery-historian”目录下方【GOPATH即上面配置的工作空间】

    ps:我直接“cd $GOPATH/src/github.com/google/battery-historian”不行,耍了点小技巧,直接到指定目录下运行 cmd,又因为指定目录下有名为“cmd”的文件夹,只能分两步走: 

    这里写图片描述

    最后发现,先在所在盘符启动cmd(我是D盘),然后直接 cd 路径就行:

    这里写图片描述
    • 运行 Battery Historian

      • cmd 执行“go run setup.go”【第一次执行要下载,时间会久一些,以后就快些】

        这里写图片描述

      • cmd 执行“go run cmd/battery-historian/battery-historian.go”

        这里写图片描述

    ps:http://blog.csdn.net/feitian_666/article/details/52756522 提供了一个在没有下载成功情况下补充“go run setup.go”的方法:手动下载【closure-library】和【closure-compiler】和【flot-axislabels】,解压放到 GOROOT 目录下 third_party 文件夹下方的的 closure-compiler、closure-library 和flot-axislabels 文件夹,如果没有均手动创建。

    这里写图片描述
    这里写图片描述

    二、使用

    1、运行 Battery Historian

    在上面 Building from source code 均配置成功的情况下:

    • 进入到“$GOPATH/src/github.com/google/battery-historian”目录下方
    • cmd 执行“go run setup.go”
    • cmd 执行“go run cmd/battery-historian/battery-historian.go”
    这里写图片描述

    2、导出手机的 Bugreport 文件:cmd执行“adb bugreport > bugreport.txt”

    ps:这时如果有两个设备在线上,就会报错,应该可以指定某个设备生成的,懒一点,拔掉其它。只留下一个,ByTheWay,生成的待分析文件会有点大

    这里写图片描述

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

    这里写图片描述
    这里写图片描述
    这里写图片描述

    特效篇:Android性能优化之电量篇 - http://hukai.me/android-performance-battery/

    // 得到整个设备的电量消耗信息
    $ adb shell dumpsys batterystats > xxx.txt
    // 得到指定app相关的电量消耗信息
    $ adb shell dumpsys batterystats > com.package.name > xxx.txt
    
    // 通过Google编写的python脚本把数据信息转换成可读性更好的html文件
    // https://github.com/google/battery-historian/blob/master/scripts/historian.py
    $ python historian.py xxx.txt > xxx.html  


    参考文章: 
    https://github.com/google/battery-historian 
    http://blog.csdn.net/feitian_666/article/details/52756522 
    http://blog.csdn.net/feitian_666/article/details/52756522

    文章转自:https://blog.csdn.net/zeqiao/article/details/77504477

    end

    battery-historian 使用方法

  • 相关阅读:
    zabbix 组信息
    perl tk说明
    perl tk说明
    haproxy ssl相关配置
    haproxy ssl相关配置
    haproxy 关闭ssl 3.0 加密
    haproxy 关闭ssl 3.0 加密
    【华为敏捷/DevOps实践】4. 如何从Excel做项目管理的方式中走出来
    【华为云实战开发】13.如何在云端快速搭建python网站
    【华为云实战开发】12.如何在云端快速开展Swagger接口测试
  • 原文地址:https://www.cnblogs.com/lindows/p/14983291.html
Copyright © 2011-2022 走看看