[转]静置功耗测试方法和工具

方法1:Battery Historian 分析工具

链接: http://bugreport.pt.xiaomi.com:9999/ 

在 Battery Historian 中打开后,导入静置测试的Log,在App Selection中找到APP,查看  App Stats 中的信息,如图所示


方法2:Log详细指标收集

可以在  bugreport 中查取 App 耗电信息:举例如下:

1.确定app的uid,比如可以通过找 “Package [com.tencent.mobileqq]” 找到下面的记录:

Package [com.tencent.mobileqq] (ab44b37):
userId=10156

注:一般也可以通过找 “    Apk com.tencent.mobileqq:” 直接找到 App 的详细耗电记录(参见下面2中蓝色的部分)。

2.在 bugreport 的 batterystats dump 中找到 App 的详细耗电记录,比如可以通过找 “u0a156:” 找到下面的记录:

u0a156:
Mobile network: 3.12KB received, 4.57KB sent (packets 21 received, 28 sent) // Mobile data transferred: 7.69KB (数据网络收发数据流量总和,received和sent的流量相加)
Mobile radio active: 5s 957ms (0.4%) 2x @ 122 mspp // mobile active time/count: 5s 957ms / 2 (数据网络活跃时间和次数)
Modem Idle time: 0ms (0.0%)
Modem Rx time: 35s 290ms (98.2%)
Modem Tx time: 642ms (1.8%)
[0] 408ms (63.6%)
[1] 91ms (14.2%)
[2] 134ms (20.9%)
[3] 9ms (1.4%)
[4] 0ms (0.0%)
Modem Power drain: 0mAh
Wi-Fi network: 4.53MB received, 415.95KB sent (packets 4272 received, 3435 sent) // Wifi data transferred: 4.9362MB (WiFi网络收发数据总和,received和sent的流量相加)
Wifi Running: 0ms (0.0%)
Full Wifi Lock: 0ms (0.0%)
Wifi Scan (blamed): 2s 17ms (0.0%) 1x // Wifi scan time/count: 2s 17ms / 1 (WiFi扫描时间和次数)
Wifi Scan (actual): 2s 17ms (0.0%) 1x
Background Wifi Scan: 0ms (0.0%) 0x
WiFi AP wakeups: 87
WiFi Idle time: 0ms (0.0%)
WiFi Rx time: 364ms (72.2%)
WiFi Tx time: 140ms (27.8%)
WiFi Power drain: 0mAh
Wake lock *alarm*: 576ms partial (23 times) max=131 actual=588, 588ms background partial (23 times) max=131 realtime
Wake lock *launch* realtime
Wake lock RILJ realtime
TOTAL wake: 576ms blamed partial, 588ms actual partial, 588ms actual background partial realtime // partial wakelock time: 576ms(持有partial wakelock总时间)
Sensor GPS: 588ms realtime (2 times) // GPS time/count: 588ms / 2(GPS使用时间和次数)
Sensor 21: 10h 5m 51s 485ms realtime (0 times), 9h 4m 55s 587ms background (0 times)
Foreground activities: 1h 0m 55s 647ms realtime (7 times)
Top for: 1h 0m 55s 898ms 
Background for: 9h 4m 55s 587ms 
Total running: 10h 5m 51s 485ms 
Total cpu time: u=7m 24s 100ms s=1m 30s 95ms // cpu time: 8m 54s 195ms(CPU运行总时间,u和s的时间相加)
Proc com.tencent.mobileqq:peak:
CPU: 0ms usr + 0ms krn ; 0ms fg
2 starts
Proc com.tencent.mobileqq:MSF:
CPU: 37s 120ms usr + 12s 340ms krn ; 0ms fg
Proc com.tencent.mobileqq:TMAssistantDownloadSDKService:
CPU: 0ms usr + 0ms krn ; 0ms fg
1 starts
Proc com.tencent.mobileqq:
CPU: 5m 30s 460ms usr + 1m 4s 30ms krn ; 7m 14s 230ms fg
2 starts
Proc com.tencent.mobileqq:qqfav:
CPU: 0ms usr + 0ms krn ; 0ms fg
1 starts
Apk com.tencent.mobileqq:
// wakeup alarms: 116 (wakeup alarm总次数,下面各Wakeup alarm的次数相加)
Wakeup alarm *walarm*:com.tencent.mobileqq:MSF_44652265: 115 times
Wakeup alarm *walarm*:com.tencent.mobileqq.msf.WatchdogForInfoLogin: 1 times
Service com.tencent.tmdownloader.TMAssistantDownloadService:
Created for: 0ms uptime
Starts: 0, launches: 1
Service com.tencent.mobileqq.activity.photo.PeakService:
Created for: 1s 647ms uptime
Starts: 2, launches: 2
Service com.tencent.mobileqq.pluginsdk.ipc.PluginRemoteService$Sub2:
Created for: 0ms uptime
Starts: 0, launches: 3
Service com.tencent.mobileqq.pluginsdk.ipc.PluginRemoteService$Sub1:
Created for: 0ms uptime
Starts: 0, launches: 1
Service com.tencent.mobileqq.qipc.QIPCServiceEx:
Created for: 0ms uptime
Starts: 0, launches: 2
Service com.tencent.mobileqq.app.CoreService:
Created for: 54m 30s 343ms uptime
Starts: 2, launches: 2
Service com.tencent.tmdownloader.internal.remote.RemoteOpService:
Created for: 0ms uptime
Starts: 0, launches: 1

posted @ 2019-03-20 12:52  庚拓天下  阅读(1299)  评论(0编辑  收藏  举报