AbstractTraceSink


Known direct subclasses
InMemoryRingBufferTraceSink

A AbstractTraceSink that stores TraceEvents in a fixed-size ring buffer to minimize allocations.

TraceSink

The trace sink that writes BufferedSink, to a new file per trace session.


Receives PooledTracePacketArrays from Tracks and asynchronously serializes them to a file or buffer, depending on implementation.

Note that while serialized trace events are typically written as Perfetto TracePacket protos so that they may be read by ui.perfetto.dev and queried with the corresponding TraceProcessor tools, the final serialization format is up to the AbstractTraceSink's implementation.

Summary

Public constructors

Cmn

Public functions

abstract Unit

Close the AbstractTraceSink, completing any enqueued writes.

Cmn
abstract Unit
enqueue(pooledPacketArray: PooledTracePacketArray)

Enqueue a PooledTracePacketArray to be written to the trace.

Cmn
abstract Unit

Flush any enqueued trace events to the AbstractTraceSink.

Cmn
abstract Unit

Called when the AbstractTraceSink cannot keep up with incoming trace events from Tracks.

Cmn

Public constructors

AbstractTraceSink

AbstractTraceSink()

Public functions

close

abstract fun close(): Unit

Close the AbstractTraceSink, completing any enqueued writes.

This function may be called from any thread.

enqueue

abstract fun enqueue(pooledPacketArray: PooledTracePacketArray): Unit

Enqueue a PooledTracePacketArray to be written to the trace.

This function may be called from any thread.

flush

abstract fun flush(): Unit

Flush any enqueued trace events to the AbstractTraceSink.

If the trace sink writes to persistent storage, this forces any buffered events to be written immediately. For in-memory sinks, this is typically a no-op because they do not have an underlying persistent storage destination by default.

This function may be called from any thread.

onDroppedTraceEvent

abstract fun onDroppedTraceEvent(): Unit

Called when the AbstractTraceSink cannot keep up with incoming trace events from Tracks.

This function may be called from any thread.