系统场景的唤醒源:EINT/CONN/CLDMA
EINT:
PMIC的唤醒.
a.Powerkey
唤醒后面的log会有pwrkey_int_handler
b. rtc alarm
唤醒后面的log会有alarm time is up
<2>[ 1145.475797]<3>-(0)[4497:kworker/u8:10][SPM] wake up by EINT, timer_out = 1406849, r13 = 0x41208, debug_flag = 0x9f
<7>[ 1145.475797]<3>-(0)[4497:kworker/u8:10]EINT 206 is pending
<5>[ 1145.476310]<3> (0)[53:pmic_thread]mtk_rtc_common: alarm time is up
<6>[ 1145.895970]<0> (0)[4497:kworker/u8:10]PM: suspend exit 2016-01-24 17:23:04.023386308 UTC
<2>[ 1146.231012]<3>-(0)[4497:kworker/u8:10][SPM] md_settle = 99, settle = 99
具体类型的唤醒包,可以确认:
从syslog里面搜索关键字wakeup alarm:
01-25 01:23:04.026 830 898 D AlarmManager: wakeup alarm = Alarm{3e671462 type 2 when 27213196 com.android.phone}; package = com.android.phoneneedGrouping = true
一般alarm的唤醒,除了第三方APK之外,有时会遇到类似android/phone APK的唤醒.
确认具体android的唤醒的原因,需要确定唤醒后,紧接着发下来的intent事件.
01-24 19:50:30.031 830 898 D AlarmManager: wakeup alarm = Alarm{9ba1b41 type 2 when 7259546 android}; package = androidneedGrouping = false
01-24 19:50:30.031 830 898 V ActivityManager: Broadcast: Intent { act=android.content.syncmanager.SYNC_ALARM flg=0x114 (has extras) } ordered=true userid=0 callerApp=null
搜索:android.content.syncmanager.SYNC_ALARM
可以定位到:/frameworks/base/services/core/java/com/android/server/content/SyncManager.java
进一步找对应owner确认.
phone apk的唤醒:数据网络的定时恢复.
c. others
kernel log有关键字:EINT.*is pending
序号:206
EINT 206 is pending
需要结合DCT跟cat /proc/interrupts
1.通过DCT:
2.cat /proc/interrupts :pmic-eint对应的序号是150.
289: 149 mt-eint 1 TOUCH_PANEL-eint
291: 0 mt-eint 3 11240000.msdc1 cd
294: 0 mt-eint 6 ALS-eint
295: 0 mt-eint 7 mrdump_ext_rst-eint
314: 73 mt-eint 26 irq_nfc-eint
332: 246 mt-eint 44
432: 0 mt-eint 144 iddig_eint
438: 341 mt-eint 150 pmic-eint
440: 0 mt-eint 152 spm_vcorefs_start_eint
441: 0 mt-eint 153 spm_vcorefs_end_eint
442: 0 mt-eint 154 spm_vcorefs_err_eint
<5>[30640.939329] -(0)[1191:system_server]EINT 150 is pending
......
<3>[30640.942131] (0)[69:pmic_thread]kpd: Power Key generate, pressed=1
<3>[30640.942189] (0)[69:pmic_thread]kpd: kpd: (pressed) HW keycode =116 using PMIC
CLDMA:
确认唤醒的channel ID,关键字:CLDMA_MD wakeup source
<2>[ 3072.796534]<2>-(0)[14284:kworker/u8:0][SPM] wake up by CLDMA_MD, timer_out = 5598687, r13 = 0x20001238, debug_flag = 0x9f
//唤醒点之后第一句CLDMA_MD wakeup source会打印出channel ID. 譬如该题是10
<5>[ 3072.810528]<2> (1)[23510:kworker/u9:0][ccci1/mcd]CLDMA_MD wakeup source:(1/10)
<6>[ 3072.872362]<3> (1)[14284:kworker/u8:0]PM: suspend exit 2016-02-05 11:28:18.030905923 UTC
<6>[ 3074.000405]<2> (0)[14284:kworker/u8:0]PM: suspend exit 2016-02-05 11:28:19.158954462 UTC
<2>[ 3075.262223]<3>-(0)[14284:kworker/u8:0][SPM] md_settle = 99, settle = 99
<2>[ 3075.262223]<3>-(0)[14284:kworker/u8:0][SPM] wake up by EINT, timer_out = 4159454, r13 = 0x41000, debug_flag = 0x9f
<6>[ 3075.341978]<3> (1)[14284:kworker/u8:0]PM: suspend exit 2016-02-05 11:30:28.031774693 UTC
<2>[ 3075.996184]<2>-(0)[14284:kworker/u8:0][SPM] md_settle = 99, settle = 99
[channel 10]:
需要搜索radio log确认是什么AT command唤醒了系统.
时间点:
2016-02-05 11:28:18.030905923 + 8h = 2016-02-05 19:28:18.030905923
以19:28:18搜索radio log,往下搜索,找到第一条AT<
02-05 19:28:18.032 20835 20856 D AT : AT< +CIREPI: 0
说明唤醒的AT command是AT< +CIREPI
常见的AT command的唤醒:参考下面【常见AT 命令解析】
AT +ECOPS ------->PLMN信息变化.
搜网的次数 ------------> AT: CREG CGREG (一个是CS,一个是PS)
网络PDP状态变化的次数 ----------> AT:CGEV (PDN activate/deactivate)
VOLTE功能导致唤醒的次数 -----------> AT: CIREPI CIREPH CNEMS1 CIREG EIMS
LTE数据连接 ------------> AT: EDRBSTATE
[channel 14]
一般是跟channel10一起产生,modem小区消息变化,会记录小区的信息到nvram.
[channel20/24]
数据连接的唤醒.
<2>[10133.766886]<2>-0)[SPM] wake up by CLDMA_MD, timer_out = 1901490, r13 = 0x340a133c, debug_flag = 0x31f
<5>[10133.774491]<2> 2)[ccci1/mcd]CLDMA_MD wakeup source:(4/24)
<6>[10133.822549]<1> (0)[14053:kworker/u16:2]PM: suspend exit 2016-01-06 16:37:59.027987308 UTC
<2>[10134.994190]<0>-0)[SPM] md_settle = 99, settle = 99
<2>[10134.994190]<0>-0)[SPM] wake up by CLDMA_MD, timer_out = 1918768, r13 = 0x340a133c, debug_flag = 0x31f
<5>[10134.996421]<0> 0)[ccci1/mcd]CLDMA_MD wakeup source:(4/24)
<6>[10135.087194]<1> (0)[14053:kworker/u16:2]PM: suspend exit 2016-01-06 16:38:59.069914154 UTC
<2>[10136.211339]<1>-0)[SPM] md_settle = 99, settle = 99
使用winshark打开netlog:
main log里面搜索IP 地址:
112.17.251.148
01-06 21:47:58.060 313 25080 D libc-netbsd: res_queryN name = push.hexin.cn succeed
01-06 21:47:58.060 25056 25081 I AppStore.StorageManager: ab:e:150407-372=>in removeSpuriousFiles
01-06 21:47:58.060 21561 25079 D libc-netbsd: getaddrinfo: push.hexin.cn get result from proxy >>
01-06 21:47:58.060 21561 25079 I System.out: propertyValue:true
01-06 21:47:58.061 21561 25079 I System.out: [CDS]connect[push.hexin.cn/112.17.251.148:8887] tm:90
请参考【如何确认具体一次唤醒,是哪个APK引起的】:
[channel32]
modem SIM driver获取sim GPIO状态所造成的唤醒. 这部分情况比较少,确认review 贵司sim driver是否有相关的design.
[channel34]
WIFI 跟4G 有部分频段是重叠的,modem 需要把频段的信息通知WIFI所造成的唤醒. 这部分属于正常的design.
[channel55]
VOLTE 网络的唤醒.
[channel6/42]
这是打开modem log造成的,分析功耗问题除非发现跟modem有关系,否则捉log时,不要打开modem log
具体的channel 对应的定义可以参考:
N版本:
/kernel-4.4/drivers/misc/mediatek/eccci/ccci_core.h
M版本:
/kernel-3.18/drivers/misc/mediatek/include/mt-plat/mt_ccci_common.h
L版本:
/kernel-3.10/include/mach/mt_ccci_common.h
[channel 14与10]常见AT 命令解析,注意红色字体部分字段
channel对应的表格:
CONN:
一般情况是因为打开了wifi 或者蓝牙,一般是wifi居多,APK如果建立起TCP 连接,网络包通过wifi回传给手机,都会这种类型的唤醒.
其中一次完整的唤醒有如下的log:
//第一句唤醒,wake up by CONN2AP,代表被connectivity wakeup,大部分情况是WIFI数据.
<2>[ 172.612907]<1>-(0)[142:kworker/u8:4][SPM] wake up by CONN2AP, timer_out = 19411, r13 = 0x20047238, debug_flag = 0x9c
//唤醒的时间点:
<6>[ 172.679674]<1> (3)[142:kworker/u8:4]PM: suspend exit 2015-12-27 03:09:38.023614769 UTC
<6>[ 172.948171]<1> (3)[142:kworker/u8:4]PM: suspend exit 2015-12-27 03:09:38.292113615 UTC
<6>[ 173.572666]<1> (0)[142:kworker/u8:4]PM: suspend exit 2015-12-27 03:09:38.916604538 UTC
<6>[ 173.989622]<3> (1)[142:kworker/u8:4]PM: suspend exit 2015-12-27 03:09:39.333548769 UTC
<6>[ 174.399687]<3> (3)[142:kworker/u8:4]PM: suspend exit 2015-12-27 03:09:39.743622615 UTC
//最后一句sleep的log. 只有出现md_settle才代表真正sleep.
<2>[ 176.028364]<3>-(0)[95:kworker/u8:2][SPM] md_settle = 99, settle = 99
2015-12-27 03:09:38.023614769对应的main log时间为:2015-12-27 11:09:38.023614769
确认引起唤醒的问题包:
在main log里面搜索关键字:Posix_connect Debug:
Posix_connect Debug的log,只有在应用第一次建立TCP的连接的时候才会打印,后期TCP的来回握手,并不会打印出来.
譬如下面的log,可以发现对应的时间点,是豌豆荚这个应用在发包.
【下面的log代表是那些APK在发包,有发包就有收包】
12-27 11:05:44.279 2895 3138 D Posix : [Posix_connect Debug]Process com.lava:pushservice :80
12-27 11:06:02.786 4715 4778 D Posix : [Posix_connect Debug]Process com.sina.weibo :443
12-27 11:06:07.779 4715 4798 D Posix : [Posix_connect Debug]Process com.sina.weibo :443
12-27 11:06:10.080 4827 4917 D Posix : [Posix_connect Debug]Process com.sina.weibo:remote :4828
12-27 11:06:15.465 4827 4917 D Posix : [Posix_connect Debug]Process com.sina.weibo:remote :4828
12-27 11:09:38.313 3635 3670 D Posix : [Posix_connect Debug]Process com.wandoujia.phoenix2:update_service :443
12-27 11:09:42.347 4827 4917 D Posix : [Posix_connect Debug]Process com.sina.weibo:remote :4828
12-27 11:09:49.055 4827 4917 D Posix : [Posix_connect Debug]Process com.sina.weibo:remote :4829
12-27 11:09:49.111 4827 4942 D Posix : [Posix_connect Debug]Process com.sina.weibo:remote :80
12-27 11:09:51.199 3495 3570 D Posix : [Posix_connect Debug]Process com.wandoujia.phoenix2 :80