一 常见日志关键字
1.App Crash
FATAL EXCEPTION:
2.System Crash
*** FATAL EXCEPTION IN SYSTEM PROCESS:
574 574 I ServiceManager: service ‘statusbar’ died
574 574 I ServiceManager: service ‘media.player’ died
2314 2314 E Zygote : Exit zygote because system server (2557) has terminated
2314 2314 D AndroidRuntime: >>>>>> START com.android.internal.os.ZygoteInit uid 0 <<<<<<
2960 2960 I SystemServer: Entered the Android system server!
5114 5114 D Zygote : begin preload
5114 5114 I Zygote : Preloading classes…
3.Native Crash
Build fingerprint: ’ Opp/xxx/……:userdebug/test-keys’
4.General Exception:
Exception:
5.log level: ‘V’,‘D’,‘I’,‘W’,‘E’,‘F’,‘A’,‘S’
6.单独为某个TAG设置日志输出级别
$ setprop log.tag.XXX S 或 setprop persist.log.tag.XXX S
这会影响 boolean DEBUG = Log.isLoggable(“XXX”, Log.VERBOSE)
7. Dropbox log for non-root device
$ dumpsys dropbox -p
8.logcat all (main,system,events,radio,crash,kernel)
adb logcat -b all
二 ANR
$ grep “ANR in” logcat.txt
10-01 18:13:11.984 4600 4614 E ActivityManager: ANR in com.google.android.youtube
10-01 18:14:31.720 4600 4614 E ActivityManager: ANR in com.google.android.apps.plus
10-01 18:14:31.720 4600 4614 E ActivityManager: PID: 30363
10-01 18:14:31.720 4600 4614 E ActivityManager: Reason: executing service com.google.android.apps.plus/com.google.android.apps.photos.service.PhotosService
10-01 18:14:31.720 4600 4614 E ActivityManager: Load: 35.27 / 23.9 / 16.18
10-01 18:14:31.720 4600 4614 E ActivityManager: CPU usage from 16ms to 21868ms later:
10-01 18:14:31.720 4600 4614 E ActivityManager: 74% 3361/mm-qcamera-daemon: 62% user + 12% kernel / faults: 15276 minor 10 major
10-01 18:14:31.720 4600 4614 E ActivityManager: 41% 4600/system_server: 18% user + 23% kernel / faults: 18597 minor 309 major
10-01 18:14:31.720 4600 4614 E ActivityManager: 32% 27420/com.google.android.GoogleCamera: 24% user + 7.8% kernel / faults: 48374 minor 338 major
10-01 18:14:31.720 4600 4614 E ActivityManager: 16% 130/kswapd0: 0% user + 16% kernel
10-01 18:14:31.720 4600 4614 E ActivityManager: 15% 283/mmcqd/0: 0% user + 15% kernel
10-01 18:14:31.721 4600 4614 I ActivityManager: Killing 30363:com.google.android.apps.plus/u0a206 (adj 0): bg anr
$ grep “am_anr” events.txt
10-01 18:12:49.599 4600 4614 I am_anr : [0,29761,com.google.android.youtube,953695941,executing service com.google.android.youtube/com.google.android.apps.youtube.app.offline.transfer.OfflineTransferService]
10-01 18:14:10.211 4600 4614 I am_anr : [0,30363,com.google.android.apps.plus,953728580,executing service com.google.android.apps.plus/com.google.android.apps.photos.service.PhotosService]
手动触发ANR
adb shell
ls -l /data/anr
adb pull /data/anr
cat anr/traces*.txt
adb shell
kill -3 pidof system_server
more /data/anr/traces.txt (/data/anr/trace_01)
……
没有产生/data/anr/trace*日志? 先创建,再kill -3 PID
touch /data/anr/traces.txt
kill -3 PID
more /data/anr/traces.txt
2.1 ANR日志解析
“android.display” prio=5 tid=21 Native
| group=“main” sCount=1 dsCount=0 flags=1 obj=0x13381e58 self=0x707bf30600
| sysTid=20957 nice=-3 cgrp=default sched=0/0 handle=0x7068ff74f0
| state=S schedstat=( 545700310 241734580 1108 ) utm=46 stm=8 core=3 HZ=100
| stack=0x7068ef5000-0x7068ef7000 stackSize=1037KB
nice值越小则优先级越高,范围-20 ~ 19,此处nice=-3,优先级比较高
schedstat (来自 /proc/xx/schedstat) 括号中的3个数字依次是Running、Runnable、Switch
Running时间:CPU运行的时间,单位ns
Runable时间:RunQueue队列的等待时间,单位ns
Switch次数:CPU调度切换次数
紧接着的是utm和stm
utm: 该线程在用户态所执行的时间,单位是jiffies,jiffies定义为sysconf(_SC_CLK_TCK),默认等于10ms
stm: 该线程在内核态所执行的时间,单位是jiffies,默认等于10ms
可见,该线程Running= 545700310 ns,也约等于545 ms; CPU运行时间包括用户态(utm)和内核态(stm)。
utm + stm = (48 + 6) ×10 ms = 540 ms
utm + stm = schedstat[0]
2.2 查找死锁
线程 A 在等待线程 B 占用的某些资源,而线程 B 也在等待线程 A 占用的某些资源
“Binder_B” prio=5 tid=73 Blocked
| group=“main” sCount=1 dsCount=0 obj=0x13faa0a0 self=0x95e24800
| sysTid=2016 nice=0 cgrp=default sched=0/0 handle=0x8b68d930
| state=S schedstat=( 9351576559 4141431119 16920 ) utm=819 stm=116 core=1 HZ=100
at com.android.server.pm.UserManagerService.exists(UserManagerService.java:387)
- waiting to lock <0x025f9b02> (a android.util.ArrayMap) held by thread 20
at com.android.server.pm.PackageManagerService.getApplicationInfo(PackageManagerService.java:2848)
at com.android.server.AppOpsService.getOpsRawLocked(AppOpsService.java:881)
at com.android.server.AppOpsService.getOpsLocked(AppOpsService.java:856)
at com.android.server.AppOpsService.noteOperationUnchecked(AppOpsService.java:719) - locked <0x0231885a> (a com.android.server.AppOpsService)
at com.android.server.AppOpsService.noteOperation(AppOpsService.java:713)
at com.android.server.AppOpsServiceMountServiceInternalImpl.getExternalStorageMountMode(MountService.java:3416)
at com.android.server.am.ActivityManagerService.startProcessLocked(ActivityManagerService.java:3228)
at com.android.server.am.ActivityManagerService.startProcessLocked(ActivityManagerService.java:3170)
at com.android.server.am.ActivityManagerService.startProcessLocked(ActivityManagerService.java:3059)
at com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:1070) - locked <0x044d166f> (a com.android.server.am.ActivityManagerService)
at com.android.server.am.ActivityManagerService.finishReceiver(ActivityManagerService.java:16950)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:494)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2432)
at android.os.Binder.execTransact(Binder.java:453)
“PackageManager” prio=5 tid=20 Blocked
| group=“main” sCount=1 dsCount=0 obj=0x1304f4a0 self=0xa7f43900
| sysTid=1300 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x9fcf9930
| state=S schedstat=( 26190141996 13612154802 44357 ) utm=2410 stm=209 core=2 HZ=100
| stack=0x9fbf7000-0x9fbf9000 stackSize=1038KB
| held mutexes=
at com.android.server.AppOpsService.noteOperationUnchecked(AppOpsService.java:718) - waiting to lock <0x0231885a> (a com.android.server.AppOpsService) held by thread 73
at com.android.server.AppOpsService.noteOperation(AppOpsService.java:713)
at com.android.server.AppOpsService$2.getMountMode(AppOpsService.java:260)
at com.android.server.AppOpsServiceMountServiceInternalImpl.hasExternalStorage(MountService.java:3431)
at com.android.server.MountService.getVolumeList(MountService.java:2609)
at android.os.storage.StorageManager.getVolumeList(StorageManager.java:880)
at android.os.Environment$UserEnvironment.getExternalDirs(Environment.java:83)
at android.os.Environment.isExternalStorageEmulated(Environment.java:708)
at com.android.server.pm.PackageManagerService.isExternalMediaAvailable(PackageManagerService.java:9327)
at com.android.server.pm.PackageManagerService.startCleaningPackages(PackageManagerService.java:9367) - locked <0x025f9b02> (a android.util.ArrayMap)
at com.android.server.pm.PackageManagerServicePackageHandler.handleMessage(PackageManagerService.java:1122)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
- Activity
查看处于focus状态的 Activity
$ grep “am_focused_activity” bugreport.txt
10-01 18:10:41.409 4600 14112 I am_focused_activity: [0,com.google.android.GoogleCamera/com.android.camera.CameraActivity]
10-01 18:11:17.313 4600 5687 I am_focused_activity: [0,com.google.android.googlequicksearchbox/com.google.android.launcher.GEL]
10-01 18:11:52.747 4600 14113 I am_focused_activity: [0,com.google.android.GoogleCamera/com.android.camera.CameraActivity]
10-01 18:14:07.762 4600 5687 I am_focused_activity: [0,com.google.android.googlequicksearchbox/com.google.android.launcher.GEL]
查看进程启动事件
$ grep “Start proc” bugreport.txt
10-01 18:09:15.309 4600 4612 I ActivityManager: Start proc 24533:com.metago.astro/u0a240 for broadcast com.metago.astro/com.inmobi.commons.analytics.androidsdk.IMAdTrackerReceiver
10-01 18:09:15.687 4600 14112 I ActivityManager: Start proc 24548:com.google.android.apps.fitness/u0a173 for service com.google.android.apps.fitness/.api.services.ActivityUpsamplingService
10-01 18:09:15.777 4600 6604 I ActivityManager: Start proc 24563:cloudtv.hdwidgets/u0a145 for broadcast cloudtv.hdwidgets/cloudtv.switches.SwitchSystemUpdateReceiver
10-01 18:09:20.574 4600 6604 I ActivityManager: Start proc 24617:com.wageworks.ezreceipts/u0a111 for broadcast com.wageworks.ezreceipts/.ui.managers.IntentReceiver
进程抖动
$ grep -e “am_proc_died” -e “am_proc_start” bugreport.txt
10-01 18:07:06.494 4600 9696 I am_proc_died: [0,20074,com.android.musicfx]
10-01 18:07:06.555 4600 6606 I am_proc_died: [0,31166,com.concur.breeze]
10-01 18:07:06.566 4600 14112 I am_proc_died: [0,18812,com.google.android.apps.fitness]
10-01 18:07:07.018 4600 7513 I am_proc_start: [0,20361,10113,com.sony.playmemories.mobile,broadcast,com.sony.playmemories.mobile/.service.StartupReceiver]
10-01 18:07:07.357 4600 4614 I am_proc_start: [0,20381,10056,com.google.android.talk,service,com.google.android.talk/com.google.android.libraries.hangouts.video.CallService]
10-01 18:07:07.784 4600 4612 I am_proc_start: [0,20402,10190,com.andcreate.app.trafficmonitor:loopback_measure_serivce,service,com.andcreate.app.trafficmonitor/.loopback.LoopbackMeasureService]
10-01 18:07:10.753 4600 5997 I am_proc_start: [0,20450,10097,com.amazon.mShop.android.shopping,broadcast,com.amazon.mShop.android.shopping/com.amazon.identity.auth.device.storage.LambortishClock$ChangeTimestampsBroadcastReceiver]
10-01 18:07:15.267 4600 6605 I am_proc_start: [0,20539,10173,com.google.android.apps.fitness,service,com.google.android.apps.fitness/.api.services.ActivityUpsamplingService]
10-01 18:07:15.985 4600 4612 I am_proc_start: [0,20568,10022,com.android.musicfx,broadcast,com.android.musicfx/.ControlPanelReceiver]
10-01 18:07:16.315 4600 7512 I am_proc_died: [0,20096,com.google.android.GoogleCamera]
4. 广播
查看历史广播
历史广播是指已发送的广播,按时间逆序排列。
summary(摘要)部分用于提供最近 300 个前台广播和最近 300 个后台广播的概况
dumpsys activity broadcasts
Historical broadcasts summary [foreground]:
#0: act=android.intent.action.SCREEN_ON flg=0x50000010
+1ms dispatch +90ms finish
enq=2015-10-29 17:10:51 disp=2015-10-29 17:10:51 fin=2015-10-29 17:10:51
#1: act=android.intent.action.SCREEN_OFF flg=0x50000010
0 dispatch +60ms finish
enq=2015-10-29 17:10:05 disp=2015-10-29 17:10:05 fin=2015-10-29 17:10:05
…
Historical broadcasts summary [background]:
detail (详情)部分包含最近50条前台广播和最近50条后台广播的完整信息,以及每个广播的接收方,其中:
具有 BroadcastFilter 条目的接收方是在运行时注册的,并且只会被发送到已在运行的进程。
具有 ResolveInfo 条目的接收方是通过AndroidManifest注册的,AMS 会为每个ResolveInfo启动相应进程(如果进程尚未运行)
Historical broadcasts [foreground]:
…
Historical broadcasts [background]:
Historical Broadcast background #0:
…
Historical Broadcast background #5:
BroadcastRecord{18dbb16 u0 android.intent.action.USER_PRESENT} to user 0
Intent { act=android.intent.action.USER_PRESENT flg=0x24000010 }
caller=com.android.systemui 2925:com.android.systemui/u0a27 pid=2925 uid=10027
enqueueClockTime=2015-10-29 17:10:55 dispatchClockTime=2015-10-29 17:10:55
dispatchTime=-2s321ms (0 since enq) finishTime=-2s320ms (+1ms since disp)
Receiver #0: BroadcastFilter{8181cc1 u-1 ReceiverList{5d929a8 902 system/1000/u-1 local:eca4dcb}}
Receiver #1: BroadcastFilter{6371c97 u-1 ReceiverList{2938b16 902 system/1000/u-1 local:840b831}}
…
Receiver #19: BroadcastFilter{93f16b u0 ReceiverList{5c61eba 17016 com.google.android.gm/10079/u0 remote:24083e5}}
Historical Broadcast background #37:
BroadcastRecord{7f6dd6 u0 android.hardware.action.NEW_PICTURE} to user 0
Intent { act=android.hardware.action.NEW_PICTURE dat=content://media/external/images/media/6345 flg=0x10 }
caller=com.google.android.GoogleCamera 32734:com.google.android.GoogleCamera/u0a53 pid=32734 uid=10053
enqueueClockTime=2015-10-29 17:09:48 dispatchClockTime=2015-10-29 17:09:49
dispatchTime=-45s720ms (+399ms since enq) finishTime=-45s701ms (+19ms since disp)
resultTo=null resultCode=0 resultData=null
nextReceiver=4 receiver=null
Receiver #0: ResolveInfo{33d2857 com.google.android.gms/com.google.android.libraries.social.mediamonitor.MediaMonitor m=0x608000}
priority=0 preferredOrder=0 match=0x608000 specificIndex=-1 isDefault=false
ActivityInfo:
name=com.google.android.libraries.social.mediamonitor.MediaMonitor
packageName=com.google.android.gms
enabled=true exported=true processName=com.google.android.gms
…
Receiver #2: ResolveInfo{743f82d com.google.android.apps.photos/com.google.android.libraries.social.mediamonitor.MediaMonitor m=0x608000}
priority=0 preferredOrder=0 match=0x608000 specificIndex=-1 isDefault=false
ActivityInfo:
name=com.google.android.libraries.social.mediamonitor.MediaMonitor
packageName=com.google.android.apps.photos
enabled=true exported=true processName=com.google.android.apps.photos
查看待发送的广播
Active ordered broadcasts [background]:
Active Ordered Broadcast background #133: // size of queue
…
广播状态
dumpsys activity broadcast-stats
ACTIVITY MANAGER BROADCAST STATS STATE (dumpsys activity broadcast-stats)
Current stats (from -2h9m19s395ms to now, +1h33m8s105ms uptime):
android.intent.action.BOOT_COMPLETED:
Number received: 64, skipped: 3
Total dispatch time: +52s221ms, max: +52s221ms
Package null: 1 times
android.intent.action.LOCKED_BOOT_COMPLETED:
Number received: 6, skipped: 0
Total dispatch time: +2s367ms, max: +2s367ms
Package null: 1 times
android.intent.action.SIM_STATE_CHANGED:
Number received: 22, skipped: 0
Total dispatch time: +2s149ms, max: +1s484ms
Package null: 4 times
5. Monitor
monitor竞争日志通常情况下表明系统负载过重,从而导致所有进程都变慢了。
ART 记录的长时间占用monitor事件:
system.txt:
10-01 18:12:44.343 29761 29914 W art : Long monitor contention event with owner method=void android.database.sqlite.SQLiteClosable.acquireReference() from SQLiteClosable.java:52 waiters=0 for 3.914s
events.txt
10-01 18:12:44.364 29761 29914 I dvm_lock_sample: [com.google.android.youtube,0,pool-3-thread-9,3914,ScheduledTaskMaster.java,138,SQLiteClosable.java,52,100]
/system/core/logcat/event.logtags
dvm_lock_sample (process|3),(main|1|5),(thread|3),(time|1|3),(file|3),(line|1|5),(ownerfile|3),(ownerline|1|5),(sample_percent|1|6)
6. Dex2oat
app下载更新时,编译可能会在后台进行编译,占用大量CPU资源,增加系统负载
09-14 06:27:05.670 2508 2587 E ActivityManager: CPU usage from 0ms to 5857ms later:
09-14 06:27:05.670 2508 2587 E ActivityManager: 84% 5708/dex2oat: 81% user + 2.3% kernel / faults: 3731 minor 1 major
09-14 06:27:05.670 2508 2587 E ActivityManager: 73% 2508/system_server: 21% user + 51% kernel / faults: 10019 minor 28 major
09-14 06:27:05.670 2508 2587 E ActivityManager: 1% 3935/com.android.phone: 0.3% user + 0.6% kernel / faults: 2684 minor 2 major
动态加载jar包
09-14 07:29:20.433 15736 15736 I dex2oat : /system/bin/dex2oat -j4 --dex-file=/data/user/0/com.facebook.katana/app_secondary_program_dex/program-72cef82b591768306676e10161c886b58b34315a308602be.dex.jar --oat-file=/data/user/0/com.facebook.katana/app_secondary_program_dex_opt/program-72cef82b591768306676e10161c886b58b34315a308602be.dex.dex
…
09-14 07:29:25.102 15736 15736 I dex2oat : dex2oat took 4.669s (threads: 4) arena alloc=7MB java alloc=3MB native alloc=29MB free=4MB
7. 日志时间对齐
system.txt
10-03 17:19:52.939 1963 2071 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.google.android.googlequicksearchbox/com.google.android.launcher.GEL (has extras)} from uid 1000 on display 0
events.txt
10-03 17:19:54.279 1963 2071 I am_focused_activity: [0,com.google.android.googlequicksearchbox/com.google.android.launcher.GEL]
内核 (dmesg) 日志采用不同的时间基准,自kernel启动的时间来标记日志内容(以秒为单位)。
要对照logcat日志时间,可搜索“suspend exit”(退出挂起状态)和“suspend entry”(进入挂起状态)消息:
<6>[201640.779997] PM: suspend exit 2015-10-03 19:11:06.646094058 UTC
…
<6>[201644.854315] PM: suspend entry 2015-10-03 19:11:10.720416452 UTC
此外,内核日志使用 UTC 时区,中国在+8区,计算时需要将其+8小时
Android M+(一种更nice的方式):
$ adb logcat -b kernel
05-25 23:03:47.217 0 0 I : Booting Linux on physical CPU 0x0
05-25 23:03:47.217 0 0 I : Linux version 4.4.78 (yanqingzhou@qiku) (gcc version 4.9.x 20150123 (prerelease) (GCC) ) #1 SMP PREEMPT Fri Jun 1 11:58:00 CST 2018
05-25 23:03:47.217 0 0 I Boot CPU: AArch64 Processor [51af8014]
05-25 23:03:47.217 0 0 I Machine : Qualcomm Technologies, Inc. SDM 660 PM660 + PM660L Int. Audio Codec MTP
05-25 23:03:47.217 0 0 I earlycon: Early serial console at MMIO 0xc170000 (options ‘’)
8. Power
event 日志中包含屏幕电源状态信息,其中 0 表示亮屏,1 表示灭屏,2 表示已锁屏
$ grep screen_toggled events.txt
10-18 15:05:04.383 992 992 I screen_toggled: 1
10-18 15:05:07.010 992 992 I screen_toggled: 0
10-18 15:23:15.063 992 992 I screen_toggled: 1
10-18 15:23:25.684 992 992 I screen_toggled: 0
10-18 15:36:31.623 992 992 I screen_toggled: 1
10-18 15:36:37.660 3283 3283 I screen_toggled: 2
$ adb shell dumpsys power
Wake Locks: size=1
PARTIAL_WAKE_LOCK ‘AudioMix’ ACQ=-1s875ms (uid=1041)
9. 进程运行时
Ødumpsys procstats
包含有关进程及相关服务已运行时长的完整统计信息,搜索 AGGREGATED OVER 以查看最近3小时或24小时的数据,然后搜索 Summary: 以查看进程列表、这些进程已以各种优先级运行的时长,以及它们使用 RAM 的情况
(格式为“最小-平均-最大 PSS”/“最小-平均-最大 USS)
AGGREGATED OVER LAST 24 HOURS:
System memory usage:
…
Per-Package Stats:
Summary:
…
- com.google.android.gms.persistent / u0a13 / v8186448:
TOTAL: 100% (21MB-27MB-40MB/20MB-24MB-38MB over 597)
Top: 51% (22MB-26MB-38MB/21MB-24MB-36MB over 383)
Imp Fg: 49% (21MB-27MB-40MB/20MB-25MB-38MB over 214)
…
Start time: 2015-10-19 09:14:37
Total elapsed time: +1d0h22m7s390ms (partial) libart.so AGGREGATED OVER LAST 3 HOURS:
System memory usage:
…
Per-Package Stats:
…
Summary: - com.google.android.gms.persistent / u0a13 / v8186448:
TOTAL: 100% (23MB-27MB-32MB/21MB-25MB-29MB over 111)
Top: 61% (23MB-26MB-31MB/21MB-24MB-28MB over 67)
Imp Fg: 39% (23MB-28MB-32MB/21MB-26MB-29MB over 44)
…
Start time: 2015-10-20 06:49:24
Total elapsed time: +2h46m59s736ms (partial) libart.so Ødumpsys activity processes
会列出当前正在运行的所有进程,并按oom_adj得分排序(Android 通过为进程分配oom_adj值来表明进程的重要性,该值可由AMS动态更新),有些进程会显示导致其运行的更多信息。在以下示例中,以红色显示的条目表明 gms.persistent 进程正在以 vis(可见)优先级运行,因为该系统进程已经与NLS绑定。
Process LRU list (sorted by oom_adj, 34 total, non-act at 14, non-svc at 14):
PERS #33: sys F/ /P trm: 0 902:system/1000 (fixed)
PERS #32: pers F/ /P trm: 0 2925:com.android.systemui/u0a27 (fixed)
PERS #31: pers F/ /P trm: 0 3477:com.quicinc.cne.CNEService/1000 (fixed)
PERS #30: pers F/ /P trm: 0 3484:com.android.nfc/1027 (fixed)
PERS #29: pers F/ /P trm: 0 3502:com.qualcomm.qti.rcsbootstraputil/1001 (fixed)
PERS #28: pers F/ /P trm: 0 3534:com.qualcomm.qti.rcsimsbootstraputil/1001 (fixed)
PERS #27: pers F/ /P trm: 0 3553:com.android.phone/1001 (fixed)
Proc #25: psvc F/ /IF trm: 0 4951:com.android.bluetooth/1002 (service)
com.android.bluetooth/.hfp.HeadsetService<=Proc{902:system/1000}
Proc # 0: fore F/A/T trm: 0 3586:com.google.android.googlequicksearchbox/u0a29 (top-activity)
Proc # 5: vis F/ /T trm: 0 3745:com.google.android.gms.persistent/u0a12 (service)
com.google.android.gms/com.google.android.location.network.NetworkLocationService<=Proc{902:system/1000}
Proc # 3: vis F/ /SB trm: 0 3279:com.google.android.gms/u0a12 (service)
com.google.android.gms/.icing.service.IndexService<=Proc{947:com.google.android.googlequicksearchbox:search/u0a29}
Proc # 2: vis F/ /T trm: 0 947:com.google.android.googlequicksearchbox:search/u0a29 (service)
10. 内存
Total PSS by process:
150,067K: com.android.systemui (pid 24873)
100,450K: system (pid 24693)
88,269K: com.android.launcher3 (pid 25719 / activities)
Total PSS by OOM adjustment:
393,551K: Native
53,247K: surfaceflinger (pid 24626)
19,875K: zygote (pid 24629)
14,959K: zygote64 (pid 24628)
100,450K: System
100,450K: system (pid 24693)
226,461K: Persistent
150,067K: com.android.systemui (pid 24873)
24,916K: com.android.phone (pid 25014)
13,239K: Persistent Service
13,239K: com.android.bluetooth (pid 24842)
103,856K: Foreground
Total RAM: 5,834,260K (status normal)
Free RAM: 4,181,193K ( 170,561K cached pss + 1,985,880K cached kernel + 2,024,752K free)
Used RAM: 1,313,146K ( 986,846K used pss + 326,300K kernel)
Lost RAM: 339,921K
Tuning: 256 (large 512), oom 322,560K, restore limit 107,520K (high-end-gfx)
11. 调试 system_server bootup
以userdebug版本为例
adb shell
stop installd (for Android O+ 挂起installd: kill -19 pidof installd
)
stop
start
在Android Studio中设置好断点(比如 PMS.main)
Run -> Attach debugger to Android process
选择 system_process,Go!
然后最重要的是 (恢复installd执行,让system_server流程继续往下走):
start installd (for AndroidO+: kill -18 pidof installd
)