您的位置:首页 > 移动开发 > Android开发

Android 功耗问题debug处理(主要是睡眠时“大”电流问题的debug方法示例)

2016-11-11 11:39 375 查看
1. 在手机进入sleep后,被上层apk唤醒的debug方法

请抓取相应的待机的mobilelog,

从kernel_log中分析,

如果log中可以查找到

wake up by RTC

请在相应的main_log中查找关键字

Alarm triggering, 其后面对应的type 0, type 2所对应的APk就是唤醒系统的唤醒源,

例如:

从log 上看,问题是由于系统被alarm type 为0 & 2 的APK唤醒,分别为com.android.phone&com.google.android.gsf

01-03 13:47:52.018 653 699 V AlarmManager: Native set alarm :Alarm{41e4d570 type 2 com.android.phone}

01-03 13:47:59.056 653 699 V AlarmManager: Native set alarm :Alarm{42041000 type 2 com.google.android.gsf}

01-03 13:48:52.076 653 699 V AlarmManager: Native set alarm :Alarm{421dec08 type 2 com.android.phone}

01-03 13:48:58.264 653 699 V AlarmManager: Native set alarm :Alarm{41c04b80 type 0 com.google.android.gsf}

01-03 13:48:58.358 653 885 V AlarmManager: Native set alarm :Alarm{42007638 type 0 com.google.android.gsf}

01-03 13:48:59.090 653 699 V AlarmManager: Native set alarm :Alarm{41d47db8 type 2 com.google.android.gsf}

而release wakelock后(系统还是awake state),也会看到com.dewav.timewidget去要带有wakelock的clock, 请您去掉看看

01-03 13:49:00.355 1015 1015 V AppWidgetContext: package name: com.dewav.timewidget

01-03 13:49:00.355 1015 1015 V AppWidgetContext: context permission not changed

01-03 13:49:01.168 653 699 V AlarmManager: Native set alarm :Alarm{41e02628 type 2 com.android.phone}

2. 而对于一些与modem相关的debug,需要结合kernel log/ radio log/net log/modem log来结合分析

在kernel中发现被唤醒的时间点,可以通过以下方式将kernel log和上层的时间点联系起来,在kernel log中搜索UTC(可能
在客户端抓取的话,需要时区转换)



在kernel中搜索CPU WAKE UP关键字,可以找到对应的时间点,在结合上图经过转换后,得到上层的时间。

若是在kernel log中发现,而main log中没有发现异常

<4>[ 281.333369]-(0)[5:kworker/u:0][PCM WAKEUP NORMAL]CPU WAKE UP BY: CCIF

<5>[ 281.333369]-(0)[5:kworker/u:0][Power/Sleep] slp_abort_cnt:0,slp_normal_cnt:12

<7>[ 281.333702] (0)[5:kworker/u:0]enable(1), count(1) res=0

<7>[ 281.334564] (0)[5:kworker/u:0]enable(0), count(0) res=0

<4>[ 281.334574] (0)[5:kworker/u:0]usb save current success

<7>[ 281.335210] (0)[5:kworker/u:0]enable(0), count(0) res=1

<6>[ 281.335505]-(0)[5:kworker/u:0][Power/Kernel]:ws activate-> ccci_modem1

其中CPU WAKE UP BY: CCIF以及ws activate->ccci_modem1后,可以尝试查看radiolog中以及netlog中是否有对应时间点的

URC上报或者IP报收发。这两种case都会引起AP唤醒。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android 功耗