UiDispatcherTracer


Receives trace events from AndroidUiDispatcher, for tools that record how tasks and frame callbacks are queued and run. Install one with AndroidUiDispatcher.setTracer.

The dispatcher may call instant and counter from any thread, since tasks reach it from arbitrary threads, and calls beginSection and endSection on its own thread. It calls all of them once per dispatched task, so implementations should not be expensive.

Event names, counter names and flow IDs reflect the dispatcher's internal behavior and may change between releases.

Summary

Public functions

Unit
beginSection(name: String, flowIds: LongList)

Begins a trace section named name, associated with flowIds.

android
Unit
counter(name: String, value: Long)

Records value for the counter track named name.

android
Unit

Ends the trace section that beginSection most recently started on this thread.

android
Unit
instant(name: String, flowIds: LongList)

Emits an instant event named name, associated with flowIds.

android
Boolean

Returns true if tracing is currently active.

android

Public functions

beginSection

fun beginSection(name: String, flowIds: LongList): Unit

Begins a trace section named name, associated with flowIds. Match this with a corresponding endSection on the same thread.

counter

fun counter(name: String, value: Long): Unit

Records value for the counter track named name.

endSection

fun endSection(): Unit

Ends the trace section that beginSection most recently started on this thread.

instant

fun instant(name: String, flowIds: LongList): Unit

Emits an instant event named name, associated with flowIds.

isEnabled

fun isEnabled(): Boolean

Returns true if tracing is currently active.

The dispatcher calls this before doing any work to build trace arguments, so it should not be expensive.