Android性能专项测试之Batterystats
Batterystats & Battery Historian Walkthrough
Battery Historian Charts
Android应用的耗电量统计
SupplicantState
Viewing Battery Use Data
batterystats使用条件
- 5.0以上系统
- battery-historian脚本
batterystats的启动
启动统计Battery数据的话,首先要初始化batterystats数据
adb kill-server> adb devices> adb shell dumpsys batterystats --reset
上面的操作执行完毕后,拔掉手机,操作你的App,操作完成后,重新连接手机,执行下面的命令,收集Battery数据:
adb shell dumpsys batterystats > batterystats.txt
得到这些数据后,这个时候使用我们的battery-historian
来生成我们可见HTML报告:
python historian.py batterystats.txt > batterystats.html
得到的报告如下:
Battery Historian指标
在Android性能专项测试之battery-historian试用 一文中已经介绍了一些属性,但是目前又增加很多,下面来看看新加属性的意义:
属性 | 意义 |
---|---|
gps | gps是否开启 |
sync | 是否跟后台同步 |
mobile_radio | 是否开启radio |
wake_reason | 唤醒原因 |
phone_in_call | 进行通话 |
batterystats信息过滤
Battery History
电量相关数据的时间序列:
Battery History (0% used, 152 used of 256KB, 5 strings using 256):0 (9) RESET:TIME: 2015-10-09-19-50-150 (2) 009 status=charging health=good plug=usb temp=324 volt=3683 +running +wake_lock +wifi_full_lock +audio +screen +plugged data_conn=lte phone_signal_strength=moderate brightness=bright +wifi_running +wifi wifi_signal_strength=4 wifi_suppl=completed top=u0a34:"com.google.android.googlequicksearchbox"0 (2) 009 user=0:"0"0 (2) 009 userfg=0:"0"+189ms (2) 009 volt=3660+216ms (2) 009 volt=3688+8s387ms (2) 009 +gps conn=3:"CONNECTED"+9s387ms (2) 009 -top=u0a34:"com.google.android.googlequicksearchbox"+9s387ms (2) 009 -gps +top=u0a130:"com.example.android.sunshine.app"+9s569ms (2) 009 +mobile_radio conn=3:"DISCONNECTED"+10s217ms (2) 009 volt=3577+17s294ms (2) 009 volt=3619+20s216ms (2) 009 volt=3576+21s530ms (1) 009 +wifi_scan+22s801ms (1) 009 -wifi_scan+29s842ms (1) 009 -mobile_radio+30s252ms (2) 009 volt=3616
Per-PID Stats
每一个进程执行了多长的时间
Per-PID Stats:PID 0 wake time: +396msPID 868 wake time: +1s682msPID 1402 wake time: +539msPID 0 wake time: +6s473msPID 868 wake time: +3msPID 1723 wake time: +166msPID 4841 wake time: +11m1s479msPID 19942 wake time: +271msPID 868 wake time: +42msPID 21564 wake time: +172msPID 15488 wake time: +67msPID 4841 wake time: +6s512msPID 4841 wake time: +6s512msPID 18217 wake time: +126msPID 3876 wake time: +228msPID 868 wake time: +20s440msPID 16547 wake time: +23msPID 22121 wake time: +288msPID 22146 wake time: +59msPID 16424 wake time: +485ms
Statistics since last charge
Statistics since last charge:System starts: 0, currently on battery: falseTime on battery: 0ms (0.0%) realtime, 0ms (0.0%) uptimeTime on battery screen off: 0ms (0.0%) realtime, 0ms (0.0%) uptimeTotal run time: 34s 134ms realtime, 34s 134ms uptimeStart clock time: 2015-10-09-19-50-15Screen on: 0ms (--%) 0x, Interactive: 0ms (--%)Screen brightnesses: (no activity)Connectivity changes: 2Mobile total received: 0B, sent: 0B (packets received 0, sent 0)Phone signal levels: (no activity)Signal scanning time: 0msRadio types: (no activity)Mobile radio active time: 0ms (--%) 0xMobile radio active adjusted time: 0ms (--%)Wi-Fi total received: 0B, sent: 0B (packets received 0, sent 0)Wifi on: 0ms (--%), Wifi running: 0ms (--%)Wifi states: (no activity)Wifi supplicant states: (no activity)Wifi signal levels: (no activity)Bluetooth on: 0ms (--%)Bluetooth states: (no activity)
Estimated power use (mAh)
目前只能算比较粗略的估计,不能作为实际消耗数据,期待google更为精准的数据
Estimated power use (mAh):Capacity: 3220, Computed drain: -2444.11370879, actual drain: 0.00000000Idle: 24.7Uid u0a46: -0.01197222Uid u0a100: -0.04600000Uid u0a29: -0.07444444Uid u0a118: -0.14044444Uid u0a104: -0.73288889Uid 1000: -2.12172492Uid u0a14: -3.36807500Uid u0a99: -3.78076692Phone calls: -19.54370833Cell standby: -107.36537361Screen: -2331.64616000
Per-app mobile ms per packet
radio唤醒时间除以数据包发送次数,该时间越小代表性能越好,一个高效的App会将所有的流量转化为batches。
All partial wake locks
所有程序中wakelock,关注持续时间和数量
6.0的更新
试用了下6.0的batterystats,现在信息比5.0的更加全面,不但详细列举了不同app的耗电量,还把app中各个子模块的耗电量也输出了:
Estimated power use (mAh):Capacity: 3220, Computed drain: 1163, actual drain: 451-644Screen: 361Uid u0a99: 189 ( cpu=13.2 wake=0.000408 radio=102 wifi=6.35 gps=67.8 )Uid u0a94: 127 ( cpu=6.99 wake=0.00528 radio=118 wifi=0.451 gps=0.181 sensor=0.836 )Uid 0: 111 ( cpu=30.2 wake=5.13 radio=75.0 wifi=0.242 )Cell standby: 79.8 ( radio=79.8 )Uid u0a95: 63.7 ( cpu=10.9 wake=1.59 radio=50.0 wifi=0.0566 camera=1.15 )Uid 1000: 61.1 ( cpu=59.9 wake=0.642 wifi=0.100 sensor=0.525 )Uid u0a98: 22.2 ( cpu=0.261 wake=0.00395 radio=21.9 wifi=0.0817 )Uid u0a100: 19.0 ( cpu=10.4 wake=0.00502 radio=7.90 wifi=0.624 gps=0.00150 sensor=0.0554 )Uid u0a35: 14.3 ( cpu=14.0 wake=0.158 wifi=0.0804 )Uid u0a15: 14.1 ( cpu=3.18 wake=1.72 radio=8.71 wifi=0.466 )Uid u0a108: 13.9 ( cpu=3.23 radio=10.6 wifi=0.0228 )Uid u0a103: 12.2 ( cpu=2.79 wake=0.00260 radio=8.11 wifi=0.811 gps=0.291 sensor=0.187 )Uid u0a110: 10.8 ( cpu=0.910 radio=9.92 wifi=0.00682 )Uid u0a105: 10.6 ( cpu=5.59 radio=4.95 wifi=0.0642 )Idle: 9.40
Android性能专项测试之Batterystats相关推荐
- Android性能专项测试之GPU Monitor
Testing Display Performance Speed up your app GPU Monitor能做什么? 分析GPU的性能,实时查看绘制每一帧所花费的时间 GPU Monitor使 ...
- Android性能专项测试之Heap Viewer工具
参考文章:Heap Viewer Android 内存监测工具 DDMS –> Heap 使用DDMS中的内存监测工具Heap来优化内存 Heap Viewer能做什么? 实时查看App分配的内 ...
- android专项测试 方案,Android性能专项测试.pdf
目录 前言 battery-historian试用 MemoryMonitor工具 HeapViewer工具 AllocationTracker(DeviceMonitor) AllocationTr ...
- 移动端性能专项测试之 CPU
指标背景 很多场景下我们去使用 App,可能会碰到手机会出现发热发烫的现象.这是因为 CPU 使用率过高.CPU 过于繁忙,会使得整个系统无法响应用户,整体性能降低,用户体验变得相当差,也容易引起 A ...
- | 移动端性能专项测试之CPU资源
1.指标背景 很多场景下我们去使用 App,可能会碰到手机会出现发热发烫的现象.这是因为 CPU 使用率过高.CPU 过于繁忙,会使得整个系统无法响应用户,整体性能降低,用户体验变得相当差,也容易引起 ...
- app功耗测试软件,Android app专项测试之耗电量测试
前言 耗电量指标 待机时间成关注目标 提升用户体验 通过不同的测试场景,找出app高耗电的场景并解决 01需要的环境准备 1.python2.7(必须是2.7,3.X版本是不支持的) 2.golang ...
- Android app专项测试之耗电量测试
00 前言 耗电量指标 待机时间成关注目标 提升用户体验 通过不同的测试场景,找出app高耗电的场景并解决 01 需要的环境准备 1.python2.7(必须是2.7,3.X版本是不支持的) 2.go ...
- 安卓 App 性能专项测试之流畅度深度解析-上篇
指标背景 流畅度,顾名思义是用户感知使用App页面时的流畅情况,"App卡不卡",这是用户最直接的感受. 但是要用量化之后的数据衡量流畅度,在Android平台这边并没有直接有效的 ...
- Android系统性能优化(54)---Android性能分析专题
Android性能分析专题 1. 背景:Android App优化, 要怎么做? 2. Android App优化之性能分析工具 3. Android App优化之提升你的App启动速度之理论基 ...
最新文章
- 中国投稿第一!ACL2021开幕,历届最大审稿团,预训练刷屏
- 一片哗然!ICLR 2020被曝47%的审稿人没发过相关论文
- html中盒子模型立体结构图
- 20155220吴思其 实验2 Windows口令破解
- 欢迎使用CSDN-markdown编辑器保存
- Win7系统桌面壁纸换不了怎么办
- java 90 训练营 二期下载_90天java进阶营二期 主流java技术与热门开源项目视频教程...
- C Tricks(六) —— 数组去重的实现
- 微软认知语音服务 语音识别
- 在你的ipad上使用Vscode撸代码(快速操作向)
- 软件质量的定义以及相关理论
- UG NX 10 重新附着草图
- STM32填坑:时钟使能必须在外设初始化之前
- 神经管理学是什么样的学科?
- APP设计师必上的10个APP图标素材资源站
- 云服务器更新系统,云服务器能更新系统吗
- 语音标注的具体应用场景
- Markdown里的图片并排显示
- 用python处理excel文件_python 读写 Excel文件
- python短时傅里叶变换_python中的短时傅里叶变换