KiteTrace

object KiteTrace

The trace seam: a timeline of what the player did, for a profiler to draw.

Process wide, like KiteLog, and silent until an application installs a Sink. With no sink, every place in the engine that could trace costs one volatile read and does nothing else. ChromeTraceFormat turns what a sink receives into lines that Chrome's trace viewer and Perfetto open.

What the engine traces:

  • Spans: session/open, the phases of a seek (seek/keyframe, seek/refine, seek/precise), and track/switch.

  • Spans per frame, only when installed with perFrame: video/decode and video/present, each with the frame's timestamp in microseconds as pts.

  • Instants: audio/underrun, when the engine sees the underrun count rise, and video/drop, when the schedule drops a late frame.

Times are nanoseconds on the engine's monotonic clock. Values are strings, and a URI arrives only as its basename, so a trace cannot leak a token from a query string.

Types

Link copied to clipboard
interface Sink

Receives the engine's spans and instants while installed. Called from engine threads.

Properties

Link copied to clipboard

True while a sink is installed.

Functions

Link copied to clipboard
fun install(sink: KiteTrace.Sink?, perFrame: Boolean = false)

Installs sink, replacing any previous one. Null returns the player to silence. perFrame adds a span for every decoded and every presented frame, which is many per second.