Android 功耗問題debug處理(主要是睡眠時「大」電流問題的debug方法示例)android
請在相應的main_log中查找關鍵字
Alarm triggering, 其後面對應的type 0, type 2所對應的APk就是喚醒系統的喚醒源,google
例如:
從log 上看,問題是因爲系統被alarm type 爲0 & 2 的APK喚醒,分別爲com.android.phone&com.google.android.gsfdebug
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, 請您去掉看看code
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}
在kernel中發現被喚醒的時間點,能夠經過如下方式將kernel log和上層的時間點聯繫起來,在kernel log中搜索UTC(可能
在客戶端抓取的話,須要時區轉換)orm
在kernel中搜索CPU WAKE UP關鍵字,能夠找到對應的時間點,在結合上圖通過轉換後,獲得上層的時間。blog
<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喚醒。ci