Android 解读Event和Main Log

1 Android P EventLogTags文件

Android P 9.0.0 所有EventLogTags文件List:

system/bt/EventLogTags.logtags

system/core/liblog/event.logtags

system/core/libsysutils/EventLogTags.logtags

system/core/logcat/event.logtags

system/core/logd/LogTags.cpp

system/core/logd/event.logtags

system/core/storaged/EventLogTags.logtags

frameworks/base/core/java/android/app/admin/SecurityLogTags.logtags

frameworks/base/core/java/android/content/EventLogTags.logtags

frameworks/base/core/java/android/net/EventLogTags.logtags

frameworks/base/core/java/android/os/EventLogTags.logtags

frameworks/base/core/java/android/speech/tts/EventLogTags.logtags

frameworks/base/core/java/android/webkit/EventLogTags.logtags

frameworks/base/core/java/com/android/server/DropboxLogTags.logtags

frameworks/base/core/java/org/chromium/arc/EventLogTags.logtags

frameworks/ex/common/java/com/android/common/GoogleLogTags.logtags

frameworks/native/services/surfaceflinger/EventLog/EventLogTags.logtags

packages/apps/QuickSearchBox/src/com/android/quicksearchbox/EventLogTags.logtags

packages/apps/Settings/src/com/android/settings/EventLogTags.logtags

packages/services/Telephony/src/com/android/phone/EventLogTags.logtags

frameworks/base/core/java/com/android/internal/app/EventLogTags.logtags

frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags

frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/EventLogTags.logtags

frameworks/base/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags

frameworks/base/services/core/java/com/android/server/EventLogTags.logtags

frameworks/base/services/core/java/com/android/server/am/EventLogTags.logtags

frameworks/opt/telephony/src/java/com/android/internal/telephony/EventLogTags.logtags

packages/apps/TimeZoneUpdater/src/main/com/android/timezone/updater/EventLogTags.logtags

packages/providers/CalendarProvider/src/com/android/providers/calendar/EventLogTags.logtags

packages/providers/ContactsProvider/src/com/android/providers/contacts/EventLogTags.logtags

 

2 Key Log

代码引用,通过关键字搜索“EventLog.writeEvent”

 

3 system/core/logcat/event.logtags

# Device boot timings.  We include monotonic clock values because the

# intrinsic event log times are wall-clock.

#

# Runtime starts:

3000 boot_progress_start (time|2|3)

# ZygoteInit class preloading starts:

3020 boot_progress_preload_start (time|2|3)

# ZygoteInit class preloading ends:

3030 boot_progress_preload_end (time|2|3)

......

# Dalvik VM / ART

20003 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)

......

# Database operation samples.

# db: the filename of the database

# sql: the executed query (without query args)

# time: cpu time millis (not wall time), including lock acquisition

# blocking_package: if this is on a main thread, the package name, otherwise ""

# sample_percent: the percent likelihood this query was logged

52000 db_sample (db|3),(sql|3),(time|1|3),(blocking_package|3),(sample_percent|1|6)

......

# 0 for screen off, 1 for screen on, 2 for key-guard done

70000 screen_toggled (screen_state|1|5)

3.1 screen_toggled:屏幕电源状态信息

其中 0 表示屏幕关闭,1 表示屏幕打开,2 表示已锁屏。

grep screen_toggled bugreport-2015-10-18-16-52-22.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

 

4 tools/loganalysis/src/com/android/loganalysis/parser/DvmLockSampleParser.java

    /**

     * Matches the DVM lock sample log format:

     *

     * <p>09-04 05:40:07.809 1026 10592 I dvm_lock_sample:

     * [system_server,1,Binder:1026_F,46,NetworkPolicyManagerService.java,2284,-,802,9]

     */

    private static final Pattern LOG_CONTENTION_EVENT_PATTERN =

            Pattern.compile(

                    "\\["

                            + String.join(

                                    ",\\s*",

                                    Arrays.asList(

                                       NAME_REGEX, // Process name

                                            INT_REGEX, // Process sensitivity flag

                                            NAME_REGEX, // Waiting thread name

                                            INT_REGEX, // Wait time

                                            FILE_REGEX, // Waiting Source File

                                            INT_REGEX, // Waiting Source Line

                                            FILE_REGEX, // Owner File Name ("-" if the same)

                                            INT_REGEX, // Owner Acquire Source Line

                                            INT_REGEX // Sample Percentage

                                            ))

                            + "\\]");

5 frameworks/base/core/java/android/content/EventLogTags.logtags

option java_package android.content;

52002 content_query_sample (uri|3),(projection|3),(selection|3),(sortorder|3),(time|1|3),(blocking_package|3),(sample_percent|1|6)

52003 content_update_sample (uri|3),(operation|3),(selection|3),(time|1|3),(blocking_package|3),(sample_percent|1|6)

52004 binder_sample (descriptor|3),(method_num|1|5),(time|1|3),(blocking_package|3),(sample_percent|1|6)

6 frameworks/base/core/java/com/android/server/DropboxLogTags.logtags

# -----------------------------

# BootReceiver.java

# -----------------------------

81002 dropbox_file_copy (FileName|3),(Size|1),(Tag|3)

7 frameworks/ex/common/java/com/android/common/GoogleLogTags.logtags

#####

# Android Market

# @param changes Number of changes made to database in reconstruct

202001 vending_reconstruct (changes|1)

202901 transaction_event (data|3)

#####

# Google Services Framework

203001 sync_details (authority|3),(send|1|2),(recv|1|2),(details|3)

203002 google_http_request (elapsed|2|3),(status|1),(appname|3),(reused|1)

#####

# Google Talk Service

# This event is logged when GTalkService encounters important events

204001 gtalkservice (eventType|1)

# This event is logged for GTalk connection state changes. The status field is an int, but

# it really contains 4 separate values, each taking up a byte

#     (eventType << 24) + (connection state << 16) + (connection error << 8) + network state

204002 gtalk_connection (status|1)

# This event is logged when GTalk connection is closed.

# The status field is an int, but contains 2 different values, it's represented as

#

#     (networkType << 8) + connection error

#

# the possible error values are

#

# no_error=0, no_network=1, connection_failed=2, unknown_host=3, auth_failed=4,

# auth_expired=5, heart_beat_timeout=6, server_error=7, server_reject_rate_limiting=8, unknown=10

#

# duration is the connection duration.

204003 gtalk_conn_close (status|1),(duration|1)

# This event is logged for GTalk heartbeat resets

# interval_and_nt contains both the heartbeat interval and the network type, It's represented as

#     (networkType << 16) + interval

# interval is in seconds; network type can be 0 (mobile) or 1 (wifi); ip is the host ip addr.

204004 gtalk_heartbeat_reset (interval_and_nt|1),(ip|3)

# This event is logged when an Rmq v2 packet is sent or received.

204005 c2dm (packet_type|1),(persistent_id|3),(stream_id|1),(last_stream_id|1)

#####

# Google Login Service and Setup Wizard

# This event is for when communicating to the server times out during account setup

205001 setup_server_timeout

205002 setup_required_captcha (action|3)

205003 setup_io_error (status|3)

205004 setup_server_error

205005 setup_retries_exhausted

205006 setup_no_data_network

205007 setup_completed

205008 gls_account_tried (status|1)

205009 gls_account_saved (status|1)

205010 gls_authenticate (status|1),(service|3)

205011 google_mail_switch (direction|1)

# Event for Android SNet

206001 snet (payload|3)

# TODO(williamluh): Remove this once switch to snet completed.

206003 exp_det_snet (payload|3)

# GoogleBackupTransport uses 207000

# Android Framework Metrics

208000 metrics_heartbeat

8 packages/apps/Settings/src/com/android/settings/EventLogTags.logtags

# log the type of screen lock when user sets lock screen

90200 lock_screen_type (type|3)

# log whether user accepted and activated device admin

90201 exp_det_device_admin_activated_by_user (app_signature|3)

# log whether user declined activation of device admin

90202 exp_det_device_admin_declined_by_user (app_signature|3)

# log whether user uninstalled device admin on activation screen

90203 exp_det_device_admin_uninstalled_by_user (app_signature|3)

# log latency for settings UI events

90204 settings_latency (action|1|6),(latency|1|3)

9 frameworks/base/core/java/com/android/internal/logging/EventLogTags.logtags

option java_package com.android.internal.logging;

# interaction logs

524287 sysui_view_visibility (category|1|5),(visible|1|6)

524288 sysui_action (category|1|5),(pkg|3)

524292 sysui_multi_action (content|4)

524290 sysui_count (name|3),(increment|1)

524291 sysui_histogram (name|3),(bucket|1)

# ---------------------------

# LatencyTracker.java

# ---------------------------

36070 sysui_latency (action|1|6),(latency|1|3)

# Generic event for logging when we write system files.

525000 commit_sys_config_file (name|3),(time|2|3)

10 frameworks/base/packages/SystemUI/src/com/android/systemui/EventLogTags.logtags

option java_package com.android.systemui;

# ---------------------------

# PhoneStatusBar.java

# ---------------------------

36000 sysui_statusbar_touch (type|1),(x|1),(y|1),(disable1|1),(disable2|1)

36001 sysui_heads_up_status (key|3),(visible|1)

36002 sysui_fullscreen_notification (key|3)

36003 sysui_heads_up_escalation (key|3)

# sysui_status_bar_state: Logged whenever the status bar / keyguard state changes

## state: 0: SHADE, 1: KEYGUARD, 2: SHADE_LOCKED

## keyguardShowing: 1: Keyguard shown to the user (or keyguardOccluded)

## keyguardOccluded: 1: Keyguard active, but another activity is occluding it

## bouncerShowing: 1: Bouncer currently shown to the user

## secure: 1: The user has set up a secure unlock method (PIN, password, etc.)

## currentlyInsecure: 1: No secure unlock method set up (!secure), or trusted environment (TrustManager)

36004 sysui_status_bar_state (state|1),(keyguardShowing|1),(keyguardOccluded|1),(bouncerShowing|1),(secure|1),(currentlyInsecure|1)

# ---------------------------

# PhoneStatusBarView.java

# ---------------------------

36010 sysui_panelbar_touch (type|1),(x|1),(y|1),(enabled|1)

# ---------------------------

# NotificationPanelView.java

# ---------------------------

36020 sysui_notificationpanel_touch (type|1),(x|1),(y|1)

## type: 1: SWIPE_UP_UNLOCK           Swiped up to dismiss the lockscreen.

##       2: SWIPE_DOWN_FULL_SHADE     Swiped down to enter full shade.

##       3: TAP_UNLOCK_HINT           Tapped in empty area, causes unlock hint.

##       4: SWIPE_CAMERA              Swiped the camera icon, launches.

##       5: SWIPE_DIALER              Swiped the dialer icon, launches.

##       6: TAP_LOCK                  Tapped the (unlocked) lock icon, locks the device.

##       7: TAP_NOTIFICATION_ACTIVATE Tapped a lockscreen notification, causes "tap again" hint.

##                                    Note: Second tap logged as notification_clicked.

36021 sysui_lockscreen_gesture (type|1),(lengthDp|1),(velocityDp|1)

# ---------------------------

# SettingsPanelView.java

# ---------------------------

36030 sysui_quickpanel_touch (type|1),(x|1),(y|1)

# ---------------------------

# PanelHolder.java

# ---------------------------

36040 sysui_panelholder_touch (type|1),(x|1),(y|1)

# ---------------------------

# SearchPanelView.java

# ---------------------------

36050 sysui_searchpanel_touch (type|1),(x|1),(y|1)

# ---------------------------

# Recents.java, RecentsSystemUser.java

# ---------------------------

## type: 1: USER_BIND_SERVICE        Secondary user tries binding to the system sysui service

##       2: USER_SYSTEM_BOUND        Secondary user is bound to the system sysui service

##       3: USER_SYSTEM_UNBOUND      Secondary user loses connection after system sysui has died

##       4: SYSTEM_REGISTER_USER     System sysui registers user's callbacks

##       5: SYSTEM_UNREGISTER_USER   System sysui unregisters user's callbacks (after death)

36060 sysui_recents_connection (type|1),(user|1)

11 frameworks/base/services/core/java/com/android/server/EventLogTags.logtags(重点)

# ---------------------------

# BatteryService.java

# ---------------------------

2722 battery_level (level|1|6),(voltage|1|1),(temperature|1|1)

2723 battery_status (status|1|5),(health|1|5),(present|1|5),(plugged|1|5),(technology|3)

# This is logged when battery goes from discharging to charging.

# It lets us count the total amount of time between charges and the discharge level

2730 battery_discharge (duration|2|3),(minLevel|1|6),(maxLevel|1|6)

# ---------------------------

# PowerManagerService.java

# ---------------------------

# This is logged when the device is being forced to sleep (typically by

# the user pressing the power button).

2724 power_sleep_requested (wakeLocksCleared|1|1)

# This is logged when the screen on broadcast has completed

2725 power_screen_broadcast_send (wakelockCount|1|1)

# This is logged when the screen broadcast has completed

2726 power_screen_broadcast_done (on|1|5),(broadcastDuration|2|3),(wakelockCount|1|1)

# This is logged when the screen on broadcast has completed

2727 power_screen_broadcast_stop (which|1|5),(wakelockCount|1|1)

# This is logged when the screen is turned on or off.

2728 power_screen_state (offOrOn|1|5),(becauseOfUser|1|5),(totalTouchDownTime|2|3),(touchCycles|1|1),(latency|1|3)

# This is logged when the partial wake lock (keeping the device awake

# regardless of whether the screen is off) is acquired or released.

2729 power_partial_wake_state (releasedorAcquired|1|5),(tag|3)

# The device is being asked to go into a soft sleep (typically by the ungaze gesture).

# It logs the time remaining before the device would've normally gone to sleep without the request.

2731 power_soft_sleep_requested (savedwaketimems|2)

# Power save state has changed. See BatterySaverController.java for the details.

2739 battery_saver_mode (prevOffOrOn|1|5),(nowOffOrOn|1|5),(interactive|1|5),(features|3|5),(reason|1|5)

27390 battery_saving_stats (batterySaver|1|5),(interactive|1|5),(doze|1|5),(delta_duration|2|3),(delta_battery_drain|1|1),(delta_battery_drain_percent|1|6),(total_duration|2|3),(total_battery_drain|1|1),(total_battery_drain_percent|1|6)

# Note when the user activity timeout has been overriden by ActivityManagerService

27391 user_activity_timeout_override (override|2|3)

27392 battery_saver_setting (threshold|1)

#

# Leave IDs through 2740 for more power logs (2730 used by battery_discharge above)

#

# ---------------------------

# DeviceStorageMonitorService.java

# ---------------------------

# File on cache partition was deleted

2748 cache_file_deleted (path|3)

# Storage volume state and usable space in bytes

2749 storage_state (uuid|3),(old_state|1),(new_state|1),(usable|2),(total|2)

# ---------------------------

# NotificationManagerService.java

# ---------------------------

# when a NotificationManager.notify is called. status: 0=post, 1=update, 2=ignored

2750 notification_enqueue (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(notification|3),(status|1)

# when someone tries to cancel a notification, the notification manager sometimes

# calls this with flags too

2751 notification_cancel (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(required_flags|1),(forbidden_flags|1),(reason|1|5),(listener|3)

# when someone tries to cancel all of the notifications for a particular package

2752 notification_cancel_all (uid|1|5),(pid|1|5),(pkg|3),(userid|1|5),(required_flags|1),(forbidden_flags|1),(reason|1|5),(listener|3)

# when the notification panel is shown

# Note: New tag range starts here since 2753+ have been used below.

27500 notification_panel_revealed (items|1)

# when the notification panel is hidden

27501 notification_panel_hidden

# when notifications are newly displayed on screen, or disappear from screen

27510 notification_visibility_changed (newlyVisibleKeys|3),(noLongerVisibleKeys|3)

# when notifications are expanded, or contracted

27511 notification_expansion (key|3),(user_action|1),(expanded|1),(lifespan|1),(freshness|1),(exposure|1)

# when a notification has been clicked

27520 notification_clicked (key|3),(lifespan|1),(freshness|1),(exposure|1),(rank|1),(count|1)

# when a notification action button has been clicked

27521 notification_action_clicked (key|3),(action_index|1),(lifespan|1),(freshness|1),(exposure|1),(rank|1),(count|1)

# when a notification has been canceled

27530 notification_canceled (key|3),(reason|1),(lifespan|1),(freshness|1),(exposure|1),(rank|1),(count|1),(listener|3)

# replaces 27510 with a row per notification

27531 notification_visibility (key|3),(visibile|1),(lifespan|1),(freshness|1),(exposure|1),(rank|1)

# a notification emited noise, vibration, or light

27532 notification_alert (key|3),(buzz|1),(beep|1),(blink|1)

# a notification was added to a autogroup

27533 notification_autogrouped (key|3)

# notification was removed from an autogroup

275534 notification_unautogrouped (key|3)

# ---------------------------

# Watchdog.java

# ---------------------------

2802 watchdog (Service|3)

2803 watchdog_proc_pss (Process|3),(Pid|1|5),(Pss|1|2)

2804 watchdog_soft_reset (Process|3),(Pid|1|5),(MaxPss|1|2),(Pss|1|2),(Skip|3)

2805 watchdog_hard_reset (Process|3),(Pid|1|5),(MaxPss|1|2),(Pss|1|2)

2806 watchdog_pss_stats (EmptyPss|1|2),(EmptyCount|1|1),(BackgroundPss|1|2),(BackgroundCount|1|1),(ServicePss|1|2),(ServiceCount|1|1),(VisiblePss|1|2),(VisibleCount|1|1),(ForegroundPss|1|2),(ForegroundCount|1|1),(NoPssCount|1|1)

2807 watchdog_proc_stats (DeathsInOne|1|1),(DeathsInTwo|1|1),(DeathsInThree|1|1),(DeathsInFour|1|1),(DeathsInFive|1|1)

2808 watchdog_scheduled_reboot (Now|2|1),(Interval|1|3),(StartTime|1|3),(Window|1|3),(Skip|3)

2809 watchdog_meminfo (MemFree|1|2),(Buffers|1|2),(Cached|1|2),(Active|1|2),(Inactive|1|2),(AnonPages|1|2),(Mapped|1|2),(Slab|1|2),(SReclaimable|1|2),(SUnreclaim|1|2),(PageTables|1|2)

2810 watchdog_vmstat (runtime|2|3),(pgfree|1|1),(pgactivate|1|1),(pgdeactivate|1|1),(pgfault|1|1),(pgmajfault|1|1)

2811 watchdog_requested_reboot (NoWait|1|1),(ScheduleInterval|1|3),(RecheckInterval|1|3),(StartTime|1|3),(Window|1|3),(MinScreenOff|1|3),(MinNextAlarm|1|3)

# ---------------------------

# RescueParty.java

# ---------------------------

2900 rescue_note (uid|1),(count|1),(window|2)

2901 rescue_level (level|1),(trigger_uid|1)

2902 rescue_success (level|1)

2903 rescue_failure (level|1),(msg|3)

# ---------------------------

# BackupManagerService.java

# ---------------------------

2820 backup_data_changed (Package|3)

2821 backup_start (Transport|3)

2822 backup_transport_failure (Package|3)

2823 backup_agent_failure (Package|3),(Message|3)

2824 backup_package (Package|3),(Size|1|2)

2825 backup_success (Packages|1|1),(Time|1|3)

2826 backup_reset (Transport|3)

2827 backup_initialize

2828 backup_requested (Total|1|1),(Key-Value|1|1),(Full|1|1)

2829 backup_quota_exceeded (Package|3)

2830 restore_start (Transport|3),(Source|2|5)

2831 restore_transport_failure

2832 restore_agent_failure (Package|3),(Message|3)

2833 restore_package (Package|3),(Size|1|2)

2834 restore_success (Packages|1|1),(Time|1|3)

2840 full_backup_package (Package|3)

2841 full_backup_agent_failure (Package|3),(Message|3)

2842 full_backup_transport_failure

2843 full_backup_success (Package|3)

2844 full_restore_package (Package|3)

2845 full_backup_quota_exceeded (Package|3)

2846 full_backup_cancelled (Package|3),(Message|3)

2850 backup_transport_lifecycle (Transport|3),(Bound|1|1)

2851 backup_transport_connection (Transport|3),(Connected|1|1)

# ---------------------------

# SystemServer.java

# ---------------------------

# SystemServer.run() starts:

3010 boot_progress_system_run (time|2|3)

# ---------------------------

# PackageManagerService.java

# ---------------------------

# Package Manager starts:

3060 boot_progress_pms_start (time|2|3)

# Package Manager .apk scan starts:

3070 boot_progress_pms_system_scan_start (time|2|3)

# Package Manager .apk scan starts:

3080 boot_progress_pms_data_scan_start (time|2|3)

# Package Manager .apk scan ends:

3090 boot_progress_pms_scan_end (time|2|3)

# Package Manager ready:

3100 boot_progress_pms_ready (time|2|3)

# + check activity_launch_time for Home app

# Value of "unknown sources" setting at app install time

3110 unknown_sources_enabled (value|1)

# Package Manager critical info

3120 pm_critical_info (msg|3)

# Disk usage stats for verifying quota correctness

3121 pm_package_stats (manual_time|2|3),(quota_time|2|3),(manual_data|2|2),(quota_data|2|2),(manual_cache|2|2),(quota_cache|2|2)

# ---------------------------

# WindowManagerService.java

# ---------------------------

# Out of memory for surfaces.

31000 wm_no_surface_memory (Window|3),(PID|1|5),(Operation|3)

# Task created.

31001 wm_task_created (TaskId|1|5),(StackId|1|5)

# Task moved to top (1) or bottom (0).

31002 wm_task_moved (TaskId|1|5),(ToTop|1),(Index|1)

# Task removed with source explanation.

31003 wm_task_removed (TaskId|1|5),(Reason|3)

# Stack created.

31004 wm_stack_created (StackId|1|5)

# Home stack moved to top (1) or bottom (0).

31005 wm_home_stack_moved (ToTop|1)

# Stack removed.

31006 wm_stack_removed (StackId|1|5)

# bootanim finished:

31007 wm_boot_animation_done (time|2|3)

# ---------------------------

# InputMethodManagerService.java

# ---------------------------

# Re-connecting to input method service because we haven't received its interface

32000 imf_force_reconnect_ime (IME|4),(Time Since Connect|2|3),(Showing|1|1)

# ---------------------------

# WallpaperManagerService.java

# ---------------------------

33000 wp_wallpaper_crashed (component|3)

# ---------------------------

# Device idle

# ---------------------------

34000 device_idle (state|1|5), (reason|3)

34001 device_idle_step

34002 device_idle_wake_from_idle (is_idle|1|5), (reason|3)

34003 device_idle_on_start

34004 device_idle_on_phase (what|3)

34005 device_idle_on_complete

34006 device_idle_off_start (reason|3)

34007 device_idle_off_phase (what|3)

34008 device_idle_off_complete

34009 device_idle_light (state|1|5), (reason|3)

34010 device_idle_light_step

# ---------------------------

# DisplayManagerService.java

# ---------------------------

# Auto-brightness adjustments by the user.

35000 auto_brightness_adj (old_lux|5),(old_brightness|5),(new_lux|5),(new_brightness|5)

# ---------------------------

# ConnectivityService.java

# ---------------------------

# Connectivity state changed

50020 connectivity_state_changed (type|1),(subtype|1),(state|1)

# ---------------------------

# NetworkStatsService.java

# ---------------------------

51100 netstats_mobile_sample (dev_rx_bytes|2|2),(dev_tx_bytes|2|2),(dev_rx_pkts|2|1),(dev_tx_pkts|2|1),(xt_rx_bytes|2|2),(xt_tx_bytes|2|2),(xt_rx_pkts|2|1),(xt_tx_pkts|2|1),(uid_rx_bytes|2|2),(uid_tx_bytes|2|2),(uid_rx_pkts|2|1),(uid_tx_pkts|2|1),(trusted_time|2|3)

51101 netstats_wifi_sample (dev_rx_bytes|2|2),(dev_tx_bytes|2|2),(dev_rx_pkts|2|1),(dev_tx_pkts|2|1),(xt_rx_bytes|2|2),(xt_tx_bytes|2|2),(xt_rx_pkts|2|1),(xt_tx_pkts|2|1),(uid_rx_bytes|2|2),(uid_tx_bytes|2|2),(uid_rx_pkts|2|1),(uid_tx_pkts|2|1),(trusted_time|2|3)

# ---------------------------

# LockdownVpnTracker.java

# ---------------------------

51200 lockdown_vpn_connecting (egress_net|1)

51201 lockdown_vpn_connected (egress_net|1)

51202 lockdown_vpn_error (egress_net|1)

# ---------------------------

# ConfigUpdateInstallReceiver.java

# ---------------------------

51300 config_install_failed (dir|3)

# ---------------------------

# IntentFirewall.java

# ---------------------------

51400 ifw_intent_matched (Intent Type|1|5),(Component Name|3),(Caller Uid|1|5),(Caller Pkg Count|1|1),(Caller Pkgs|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)

# ---------------------------

# IdleMaintenanceService.java

# ---------------------------

51500 idle_maintenance_window_start (time|2|3), (lastUserActivity|2|3), (batteryLevel|1|6), (batteryCharging|1|5)

51501 idle_maintenance_window_finish (time|2|3), (lastUserActivity|2|3), (batteryLevel|1|6), (batteryCharging|1|5)

# ---------------------------

# StorageManagerService.java

# ---------------------------

2755 fstrim_start (time|2|3)

2756 fstrim_finish (time|2|3)

# ---------------------------

# Job scheduler

# ---------------------------

8000 job_deferred_execution (time|2|3)

# AudioService.java

# ---------------------------

40000 volume_changed (stream|1), (prev_level|1), (level|1), (max_level|1), (caller|3)

40001 stream_devices_changed (stream|1), (prev_devices|1), (devices|1)

# ---------------------------

# GestureLauncherService.java

# ---------------------------

40100 camera_gesture_triggered (gesture_on_time|2|3), (sensor1_on_time|2|3), (sensor2_on_time|2|3), (event_extra|1|1)

# ---------------------------

# timezone/RulesManagerService.java

# ---------------------------

51600 timezone_trigger_check (token|3)

51610 timezone_request_install (token|3)

51611 timezone_install_started (token|3)

51612 timezone_install_complete (token|3), (result|1)

51620 timezone_request_uninstall (token|3)

51621 timezone_uninstall_started (token|3)

51622 timezone_uninstall_complete (token|3), (result|1)

51630 timezone_request_nothing (token|3)

51631 timezone_nothing_complete (token|3)

11.1 frameworks/base/services/java/com/android/server/SystemServer.java

            // Here we go!

            Slog.i(TAG, "Entered the Android system server!");

int uptimeMillis = (int) SystemClock.elapsedRealtime();

            EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, uptimeMillis);

            if (!mRuntimeRestart) {

                MetricsLogger.histogram(null, "boot_system_server_init", uptimeMillis);

            }

12 frameworks/base/services/core/java/com/android/server/am/EventLogTags.logtags(重点)

2719 configuration_changed (config mask|1|5)

2721 cpu (total|1|6),(user|1|6),(system|1|6),(iowait|1|6),(irq|1|6),(softirq|1|6)

# ActivityManagerService.systemReady() starts:

3040 boot_progress_ams_ready (time|2|3)

# ActivityManagerService calls enableScreenAfterBoot():

3050 boot_progress_enable_screen (time|2|3)

# Do not change these names without updating the checkin_events setting in

# google3/googledata/wireless/android/provisioning/gservices.config !!

#

# An activity is being finished:

30001 am_finish_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)

# A task is being brought to the front of the screen:

30002 am_task_to_front (User|1|5),(Task|1|5)

# An existing activity is being given a new intent:

30003 am_new_intent (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)

# A new task is being created:

30004 am_create_task (User|1|5),(Task ID|1|5)

# A new activity is being created in an existing task:

30005 am_create_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)

# An activity has been resumed into the foreground but was not already running:

30006 am_restart_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)

# An activity has been resumed and is now in the foreground:

30007 am_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)

# Application Not Responding

30008 am_anr (User|1|5),(pid|1|5),(Package Name|3),(Flags|1|5),(reason|3)

# Activity launch time

30009 am_activity_launch_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)

# Application process bound to work

30010 am_proc_bound (User|1|5),(PID|1|5),(Process Name|3)

# Application process died

30011 am_proc_died (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(ProcState|1|5)

# The Activity Manager failed to pause the given activity.

30012 am_failed_to_pause (User|1|5),(Token|1|5),(Wanting to pause|3),(Currently pausing|3)

# Attempting to pause the current activity

30013 am_pause_activity (User|1|5),(Token|1|5),(Component Name|3),(User Leaving|3)

# Application process has been started

30014 am_proc_start (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3),(Type|3),(Component|3)

# An application process has been marked as bad

30015 am_proc_bad (User|1|5),(UID|1|5),(Process Name|3)

# An application process that was bad is now marked as good

30016 am_proc_good (User|1|5),(UID|1|5),(Process Name|3)

# Reporting to applications that memory is low

30017 am_low_memory (Num Processes|1|1)

# An activity is being destroyed:

30018 am_destroy_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)

# An activity has been relaunched, resumed, and is now in the foreground:

30019 am_relaunch_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)

# An activity has been relaunched:

30020 am_relaunch_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)

# The activity's onPause has been called.

30021 am_on_paused_called (User|1|5),(Component Name|3),(Reason|3)

# The activity's onResume has been called.

30022 am_on_resume_called (User|1|5),(Component Name|3),(Reason|3)

# Kill a process to reclaim memory.

30023 am_kill (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(Reason|3)

# Discard an undelivered serialized broadcast (timeout/ANR/crash)

30024 am_broadcast_discard_filter (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(BroadcastFilter|1|5)

30025 am_broadcast_discard_app (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(App|3)

# A service is being created

30030 am_create_service (User|1|5),(Service Record|1|5),(Name|3),(UID|1|5),(PID|1|5)

# A service is being destroyed

30031 am_destroy_service (User|1|5),(Service Record|1|5),(PID|1|5)

# A process has crashed too many times, it is being cleared

30032 am_process_crashed_too_much (User|1|5),(Name|3),(PID|1|5)

# An unknown process is trying to attach to the activity manager

30033 am_drop_process (PID|1|5)

# A service has crashed too many times, it is being stopped

30034 am_service_crashed_too_much (User|1|5),(Crash Count|1|1),(Component Name|3),(PID|1|5)

# A service is going to be restarted after its process went away

30035 am_schedule_service_restart (User|1|5),(Component Name|3),(Time|2|3)

# A client was waiting for a content provider, but its process was lost

30036 am_provider_lost_process (User|1|5),(Package Name|3),(UID|1|5),(Name|3)

# The activity manager gave up on a new process taking too long to start

30037 am_process_start_timeout (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3)

# Unhandled exception

30039 am_crash (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Exception|3),(Message|3),(File|3),(Line|1|5)

# Log.wtf() called

30040 am_wtf (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Tag|3),(Message|3)

# User switched

30041 am_switch_user (id|1|5)

# Activity fully drawn time

30042 am_activity_fully_drawn_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)

# Activity set to resumed

30043 am_set_resumed_activity (User|1|5),(Component Name|3),(Reason|3)

# Stack focus

30044 am_focused_stack (User|1|5),(Focused Stack Id|1|5),(Last Focused Stack Id|1|5),(Reason|3)

# Running pre boot receiver

30045 am_pre_boot (User|1|5),(Package|3)

# Report collection of global memory state

30046 am_meminfo (Cached|2|2),(Free|2|2),(Zram|2|2),(Kernel|2|2),(Native|2|2)

# Report collection of memory used by a process

30047 am_pss (Pid|1|5),(UID|1|5),(Process Name|3),(Pss|2|2),(Uss|2|2),(SwapPss|2|2),(Rss|2|2),(StatType|1|5),(ProcState|1|5),(TimeToCollect|2|2)

# Attempting to stop an activity

30048 am_stop_activity (User|1|5),(Token|1|5),(Component Name|3)

# The activity's onStop has been called.

30049 am_on_stop_called (User|1|5),(Component Name|3),(Reason|3)

# Report changing memory conditions (Values are ProcessStats.ADJ_MEM_FACTOR* constants)

30050 am_mem_factor (Current|1|5),(Previous|1|5)

# UserState has changed

30051 am_user_state_changed (id|1|5),(state|1|5)

# Note when any processes of a uid have started running

30052 am_uid_running (UID|1|5)

# Note when all processes of a uid have stopped.

30053 am_uid_stopped (UID|1|5)

# Note when the state of a uid has become active.

30054 am_uid_active (UID|1|5)

# Note when the state of a uid has become idle (background check enforced).

30055 am_uid_idle (UID|1|5)

# Note when a service is being forcibly stopped because its app went idle.

30056 am_stop_idle_service (UID|1|5),(Component Name|3)

# The activity's onCreate has been called.

30057 am_on_create_called (User|1|5),(Component Name|3),(Reason|3)

# The activity's onRestart has been called.

30058 am_on_restart_called (User|1|5),(Component Name|3),(Reason|3)

# The activity's onStart has been called.

30059 am_on_start_called (User|1|5),(Component Name|3),(Reason|3)

# The activity's onDestroy has been called.

30060 am_on_destroy_called (User|1|5),(Component Name|3),(Reason|3)

# The activity's onActivityResult has been called.

30062 am_on_activity_result_called (User|1|5),(Component Name|3),(Reason|3)

# The task is being removed from its parent stack

30061 am_remove_task (Task ID|1|5), (Stack ID|1|5)

12.1 frameworks/base/services/core/java/com/android/server/am/AppErrors.java

// The process crashed again very quickly. If it was a bound foreground service, let's

            // try to restart again in a while, otherwise the process loses!

            Slog.w(TAG, "Process " + app.info.processName

                    + " has crashed too many times: killing!");

            EventLog.writeEvent(EventLogTags.AM_PROCESS_CRASHED_TOO_MUCH,

                    app.userId, app.info.processName, app.uid);

.......

                // We don't want to start this process again until the user

                // explicitly does so...  but for persistent process, we really

                // need to keep it running.  If a persistent process is actually

                // repeatedly crashing, then badness for everyone.

                EventLog.writeEvent(EventLogTags.AM_PROC_BAD, app.userId, app.uid,

                        app.info.processName);

......

            // Log the ANR to the event log.

            EventLog.writeEvent(EventLogTags.AM_ANR, app.userId, app.pid,

                    app.processName, app.info.flags, annotation);

12.2 frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java

                EventLog.writeEvent(EventLogTags.AM_KILL, userId, pid, processName, setAdj, reason);

                Process.killProcessQuiet(pid);

                ActivityManagerService.killProcessGroup(uid, pid);

......

12.3 frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java

void updateCpuStatsNow() {

        synchronized (mProcessCpuTracker) {

            mProcessCpuMutexFree.set(false);

            final long now = SystemClock.uptimeMillis();

            boolean haveNewCpuStats = false;

            if (MONITOR_CPU_USAGE &&

                    mLastCpuTime.get() < (now-MONITOR_CPU_MIN_TIME)) {

                mLastCpuTime.set(now);

                mProcessCpuTracker.update();

                if (mProcessCpuTracker.hasGoodLastStats()) {

                    haveNewCpuStats = true;

                    //Slog.i(TAG, mProcessCpu.printCurrentState());

                    //Slog.i(TAG, "Total CPU usage: "

                    //        + mProcessCpu.getTotalCpuPercent() + "%");

                    // Slog the cpu usage if the property is set.

                    if ("true".equals(SystemProperties.get("events.cpu"))) {

                        int user = mProcessCpuTracker.getLastUserTime();

                        int system = mProcessCpuTracker.getLastSystemTime();

                        int iowait = mProcessCpuTracker.getLastIoWaitTime();

                        int irq = mProcessCpuTracker.getLastIrqTime();

                        int softIrq = mProcessCpuTracker.getLastSoftIrqTime();

                        int idle = mProcessCpuTracker.getLastIdleTime();

                        int total = user + system + iowait + irq + softIrq + idle;

                        if (total == 0) total = 1;

                        EventLog.writeEvent(EventLogTags.CPU,

                                ((user+system+iowait+irq+softIrq) * 100) / total,

                                (user * 100) / total,

                                (system * 100) / total,

                                (iowait * 100) / total,

                                (irq * 100) / total,

                                (softIrq * 100) / total);

                    }

                }

            }

            final BatteryStatsImpl bstats = mBatteryStatsService.getActiveStatistics();

            synchronized(bstats) {

                synchronized(mPidsSelfLocked) {

                    if (haveNewCpuStats) {

                        if (bstats.startAddingCpuLocked()) {

                            int totalUTime = 0;

                            int totalSTime = 0;

                            final int N = mProcessCpuTracker.countStats();

                            for (int i=0; i<N; i++) {

                                ProcessCpuTracker.Stats st = mProcessCpuTracker.getStats(i);

                                if (!st.working) {

                                    continue;

                                }

                                ProcessRecord pr = mPidsSelfLocked.get(st.pid);

                                totalUTime += st.rel_utime;

                                totalSTime += st.rel_stime;

                                if (pr != null) {

                                    BatteryStatsImpl.Uid.Proc ps = pr.curProcBatteryStats;

                                    if (ps == null || !ps.isActive()) {

                                        pr.curProcBatteryStats = ps = bstats.getProcessStatsLocked(

                                                pr.info.uid, pr.processName);

                                    }

                                    ps.addCpuTimeLocked(st.rel_utime, st.rel_stime);

                                    pr.curCpuTime += st.rel_utime + st.rel_stime;

                                    if (pr.lastCpuTime == 0) {

                                        pr.lastCpuTime = pr.curCpuTime;

                                    }

                                } else {

                                    BatteryStatsImpl.Uid.Proc ps = st.batteryStats;

                                    if (ps == null || !ps.isActive()) {

                                        st.batteryStats = ps = bstats.getProcessStatsLocked(

                                                bstats.mapUid(st.uid), st.name);

                                    }

                                    ps.addCpuTimeLocked(st.rel_utime, st.rel_stime);

                                }

                            }

                            final int userTime = mProcessCpuTracker.getLastUserTime();

                            final int systemTime = mProcessCpuTracker.getLastSystemTime();

                            final int iowaitTime = mProcessCpuTracker.getLastIoWaitTime();

                            final int irqTime = mProcessCpuTracker.getLastIrqTime();

                            final int softIrqTime = mProcessCpuTracker.getLastSoftIrqTime();

                            final int idleTime = mProcessCpuTracker.getLastIdleTime();

                            bstats.finishAddingCpuLocked(totalUTime, totalSTime, userTime,

                                    systemTime, iowaitTime, irqTime, softIrqTime, idleTime);

                        }

                    }

                }

                if (mLastWriteTime < (now-BATTERY_STATS_TIME)) {

                    mLastWriteTime = now;

                    mBatteryStatsService.scheduleWriteToDisk();

                }

            }

        }

    }

13 参考

frameworks/base/core/java/com/android/server/BootReceiver.java

https://source.android.com/setup/contribute/read-bug-reports

https://www.jianshu.com/p/082045769443   ANR问题分析

http://www.ruanyifeng.com/blog/2011/07/linux_load_average_explained.html

http://wangxiong.top/2018/09/08/App%E6%80%A7%E8%83%BD%E7%B3%BB%E5%88%97-StrictMode/ 「App性能系列」八、StrictMode (很好)

https://www.zybuluo.com/guhuizaifeiyang/note/886803  Android 开机阶段log分析

转载于:https://www.cnblogs.com/onelikeone/p/10993644.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值