1. EventLog

在调试分析Android的过程中,比较常用的地查看EventLog,非常简洁明了地展现当前Activity各种状态,当然不至于此,比如还有window的信息。那么本文就列举以下am相关的tags含义。

本文涉及的源码类有EventLog.java, EventLogTags.java,另外tags格式的定义位于文件/system/etc/event-log-tags。

如果在终端输入:logcat -b events

那么会输出大量类似这样的信息:06-01 13:44:55.518  7361  8289 I am_create_service: [0,111484394,.StatService,10094,7769]06-01 13:44:55.540  7361  8343 I am_proc_bound: [0,3976,com.android.providers.calendar]06-01 13:44:55.599  7361  8033 I am_create_service: [0,61349752,.UpdateService,10034,1351]06-01 13:44:55.625  7361  7774 I am_destroy_service: [0,61349752,1351]...

通过字面意思,就能得到不少信息量,比如am_create_service,创建service,但是后面括号中内容的具体含义,其实有很高的价值。 接下来通过一张表格来展示含义。

Tag含义NumTagName格式功能30001am_finish_activityUser,Token,TaskID,ComponentName,Reason

30002am_task_to_frontUser,Task

30003am_new_intentUser,Token,TaskID,ComponentName,Action,MIMEType,URI,Flags

30004am_create_taskUser ,Task ID

30005am_create_activityUser ,Token ,TaskID ,ComponentName,Action,MIMEType,URI,Flags

30006am_restart_activityUser ,Token ,TaskID,ComponentName

30007am_resume_activityUser ,Token ,TaskID,ComponentName

30008am_anrUser ,pid ,Package Name,Flags ,reasonANR

30009am_activity_launch_timeUser ,Token ,ComponentName,time

30010am_proc_boundUser ,PID ,ProcessName

30011am_proc_diedUser ,PID ,ProcessName

30012am_failed_to_pauseUser ,Token ,Wanting to pause,Currently pausing

30013am_pause_activityUser ,Token ,ComponentName

30014am_proc_startUser ,PID ,UID ,ProcessName,Type,Component

30015am_proc_badUser ,UID ,ProcessName

30016am_proc_goodUser ,UID ,ProcessName

30017am_low_memoryNumProcessesLru

30018am_destroy_activityUser ,Token ,TaskID,ComponentName,Reason

30019am_relaunch_resume_activityUser ,Token ,TaskID,ComponentName

30020am_relaunch_activityUser ,Token ,TaskID,ComponentName

30021am_on_paused_calledUser ,ComponentName

30022am_on_resume_calledUser ,ComponentName

30023am_killUser ,PID ,ProcessName,OomAdj ,Reason杀进程

30024am_broadcast_discard_filterUser ,Broadcast ,Action,ReceiverNumber,BroadcastFilter

30025am_broadcast_discard_appUser ,Broadcast ,Action,ReceiverNumber,App

30030am_create_serviceUser ,ServiceRecord ,Name,UID ,PID

30031am_destroy_serviceUser ,ServiceRecord ,PID

30032am_process_crashed_too_muchUser ,Name,PID

30033am_drop_processPID

30034am_service_crashed_too_muchUser ,Crash Count,ComponentName,PID

30035am_schedule_service_restartUser ,ComponentName,Time

30036am_provider_lost_processUser ,Package Name,UID ,Name

30037am_process_start_timeoutUser ,PID ,UID ,ProcessNametimeout

30039am_crashUser ,PID ,ProcessName,Flags ,Exception,Message,File,LineCrash

30040am_wtfUser ,PID ,ProcessName,Flags ,Tag,MessageWtf

30041am_switch_userid

30042am_activity_fully_drawn_timeUser ,Token ,ComponentName,time

30043am_focused_activityUser ,ComponentName

30044am_home_stack_movedUser ,To Front ,Top Stack Id ,Focused Stack Id ,Reason

30045am_pre_bootUser ,Package

30046am_meminfoCached,Free,Zram,Kernel,Native内存

30047am_pssPid, UID, ProcessName, Pss, Uss进程

下面列举tag可能使用的部分场景:am_low_memory:位于AMS.killAllBackgroundProcesses或者AMS.appDiedLocked,记录当前Lru进程队列长度。

am_pss:位于AMS.applyOomAdjLocked或者AMS.requestPssLocked

am_meminfo:位于AMS.dumpApplicationMemoryUsage

am_proc_start:位于AMS.startProcessLocked,启动进程

am_proc_bound:位于AMS.attachApplicationLocked

am_kill: 位于ProcessRecord.kill,杀掉进程

am_anr: 位于AMS.appNotResponding

am_crash:位于AMS.handleApplicationCrashInner

am_wtf:位于AMS.handleApplicationWtf

am_activity_launch_time:位于ActivityRecord.reportLaunchTimeLocked(),后面两个参数分别是thisTime和 totalTime

am_activity_fully_drawn_time:位于ActivityRecord.reportFullyDrawnLocked, 后面两个参数分别是thisTime和 totalTime

am_broadcast_discard_filter:位于BroadcastQueue.logBroadcastReceiverDiscardLocked

am_broadcast_discard_app:位于BroadcastQueue.logBroadcastReceiverDiscardLocked

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐