AOSP Expert & Production Engineering
2 min read

Event Logs

The EventLog API

Unlike standard text logs, the Android Event Log buffer (events) uses a compact, binary format to record structured data. This makes it highly efficient for parsing system telemetry, performance metrics, and state transitions without the overhead of string parsing.

The structure of these events is defined in /system/etc/event-log-tags.

Writing to the Event Log (Java)

In the Android Framework, system services use the android.util.EventLog class:

import android.util.EventLog;

// 30001 is the tag for am_activity_launch_time
EventLog.writeEvent(30001, userId, componentName, timeMs);

Key Activity Manager Events

The ActivityManager is one of the heaviest users of the event log. Monitoring these events is critical for analyzing app launch performance.

  • am_proc_start: Fired when a new process is forked from the Zygote.
  • am_proc_died: Fired when an app process is killed or crashes.
  • am_activity_launch_time: Fired when an activity has completed drawing its first frame. This is the definitive metric for "app launch time" in Android.

Parsing Event Logs for Boot Timing

You can use logcat -b events to dump the binary logs in human-readable format. This is incredibly useful for profiling device boot times.

adb logcat -b events -d | grep "boot_progress"

AOSP defines specific tags for the boot sequence:

  • boot_progress_start
  • boot_progress_system_run
  • boot_progress_pms_system_scan_start
  • boot_progress_ams_ready
  • boot_progress_enable_screen

By analyzing the timestamps of these events, engineers can pinpoint exactly which phase of the boot sequence is causing a delay.