android刷视频耗电测试(多个设备无线连接)

使用Batterystats收集数据

1.将待测手机连接电脑(一次连接一个)

2.关闭正在运行的adb服务:

adb kill-server

3.确认设备已连接,同时获取到设备的device_id:

adb devices

4.设置无线连接(确保手机和电脑连接在同一局域网下)

4.1 设置连接端口:

adb -s {device_id} tcpip 5555    #也可设置为5556等,对于多个设备,应分别设置不同的端口

4.2 查看手机ip(如10.55.32.156)

4.3 连接:

adb connect 10.55.32.156:5555

5.断开手机与电脑的连接

6.设置Batterystats采集wake_lock数据:

adb -s {device_id} shell dumpsys batterystats --enable full-wake-history

7.重置电池数据:

adb -s {device_id} shell dumpsys batterystats --reset

8.执行想要自动执行的操作

如:滑动一次屏幕

adb -s {device_id} shell input swipe 540 1300 540 500

9.执行完成之后,收集数据报告,会在当前目录中生成报告文件

adb -s {device_id} bugreport


 

以上过程可用python脚本完成

import os
import time

device_id = "R5CN70FP42L"
ip = "10.55.32.201"
port = "5557"


os.system("adb -s " + device_id + " tcpip " + port)
os.system("adb connect " + ip + ":" + port)  # 会显示connected to 10.55.32.201:5555
time.sleep(10)   # 此时拔线,点开app,进入视频页面
os.system("adb -s " + ip + ":" + port + " shell dumpsys batterystats --enable full-wake-history")
os.system("adb -s " + ip + ":" + port + " shell dumpsys batterystats --reset")
for i in range(180):
    os.system("adb -s " + ip + ":" + port + " shell input swipe 540 1300 540 500")
    time.sleep(10)
os.system("adb -s " + ip + ":" + port + " bugreport")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

进阶的小幺

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值