Skip to content

tp: Track process lifecycle from Android framework events#5214

Open
zezeozue wants to merge 1 commit intomainfrom
dev/zezeozue/android_process
Open

tp: Track process lifecycle from Android framework events#5214
zezeozue wants to merge 1 commit intomainfrom
dev/zezeozue/android_process

Conversation

@zezeozue
Copy link
Member

In some traces, ftrace only captures an initial process snapshot. Subsequent starts and deaths come from the Android framework via AndroidProcessStartEvent (process_bound) and AndroidBinderDiedEvent (binder_died) track events carrying pid, uid, and process_name.

Hook into ProtoToArgsParser::AddParsingOverrideForType to intercept these events during arg parsing. For starts, reuse the existing process if ftrace already created it (filling in uid only), otherwise create one via StartNewProcessWithoutMainThread. For deaths, set uid/name on the process row before marking it ended.

Add ProcessTracker::EndProcess() to handle ending processes created both with and without a main thread. Add ProcessTracker::UpidForPid() as a public lookup (previously test-only).

In some traces, ftrace only captures an initial process snapshot.
Subsequent starts and deaths come from the Android framework via
AndroidProcessStartEvent (process_bound) and AndroidBinderDiedEvent
(binder_died) track events carrying pid, uid, and process_name.

Hook into ProtoToArgsParser::AddParsingOverrideForType to intercept
these events during arg parsing. For starts, reuse the existing
process if ftrace already created it (filling in uid only), otherwise
create one via StartNewProcessWithoutMainThread. For deaths, set
uid/name on the process row before marking it ended.

Add ProcessTracker::EndProcess() to handle ending processes created
both with and without a main thread. Add ProcessTracker::UpidForPid()
as a public lookup (previously test-only).

Change-Id: I167ed69400f3bbc5f9f753407cdbfae83110fd3f
@zezeozue zezeozue requested a review from LalitMaganti March 20, 2026 14:06
@zezeozue zezeozue requested a review from a team as a code owner March 20, 2026 14:06
@github-actions
Copy link

🎨 Perfetto UI Builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant