Skip to content

On Android, consider tracing significant operations with Android Trace APIs #18178

Closed
@ChrisCraik

Description

@ChrisCraik

From the Android platform side, it's often very useful to see what an app is doing from within Systrace, which shows tracing data from all the processes and services on the device: https://developer.android.com/studio/command-line/systrace

I know Flutter has its own tracing, but it's nice for platform/system-health folks to broadly know what's going on from just Systrace, especially in the context of graphics pipeline.

Note, there are now NDK APIs so you don't have to call up to Java: https://developer.android.com/ndk/guides/tracing

The tracing infrastructure on Android is optimized to be near zero cost when tracing isn't enabled, so it's just a single easily predicted branch in practice. It's somewhat expensive when tracing is on though (roughly 10us per begin/end pair), since it immediately serializes the data to a per-core trace buffer in Kernel owned memory.

Because they're expensive, we generally recommend starting with something minimal, like blocks for UI portion of frame, GPU portion of frame, and any expensive blocks of code like image decode, upload, or compositing operations. Typically want to have a couple dozen events per frame, more than that we've found to be too intrusive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: performanceRelates to speed or footprint issues (see "perf:" labels)engineflutter/engine repository. See also e: labels.platform-androidAndroid applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions