androidx.benchmark.traceprocessor


Interfaces

Classes

Insight

Individual case of a problem identified in a given trace (from a specific iteration).

android
Insight.Category

Category represents general expectations that have been violated by an insight - e.g. JIT shouldn't take longer than XX ms, or trampoline activities shouldn't be used.

android
PerfettoTrace
android
PerfettoTrace.Link

Represents a link to a given PerfettoTrace, including a URL parameter string.

android
Row

A Map that maps column name to value in a row result from a QueryResultIterator.

android
StartupInsights
android
TraceProcessor

Kotlin API for Perfetto Trace Processor, which enables SQL querying against the data stored in a Perfetto trace.

android
TraceProcessor.Handle
android
TraceProcessor.Session

Handle to query sql data from a PerfettoTrace.

android
TraceProcessor.Session.Handle
android
TraceProcessor.Tracer
android

Objects

Annotations

ExperimentalInsightApi

Annotation indicating experimental API for TraceProcessor-based Insights, finding and highlighting specific problems in a Trace.

android
ExperimentalTraceProcessorApi

Annotation indicating experimental API for initializing Trace Processor.

android

Top-level functions summary

String

Helper for fuzzy matching process name to package

android
Row
rowOf(vararg pairs: Pair<StringAny?>)

Convenience for constructing a RowResult for given column values.

android

Extension functions summary

Unit
@ExperimentalPerfettoCaptureApi
PerfettoTrace.Companion.record(
    fileLabel: String,
    appTagPackages: List<String>,
    userspaceTracingPackage: String?,
    traceCallback: ((PerfettoTrace) -> Unit)?,
    block: () -> Unit
)

Record a Perfetto System Trace for the specified block.

android
Unit
@ExperimentalPerfettoCaptureApi
PerfettoTrace.Companion.record(
    fileLabel: String,
    config: PerfettoConfig,
    userspaceTracingPackage: String?,
    traceCallback: ((PerfettoTrace) -> Unit)?,
    block: () -> Unit
)

Record a Perfetto System Trace for the specified block, with a fully custom Perfetto config, either text or binary.

android

Top-level functions

processNameLikePkg

fun processNameLikePkg(pkg: String): String

Helper for fuzzy matching process name to package

fun rowOf(vararg pairs: Pair<StringAny?>): Row

Convenience for constructing a RowResult for given column values.

Useful when asserting expected query results in tests.

Extension functions

PerfettoTrace.Companion.record

@ExperimentalPerfettoCaptureApi
fun PerfettoTrace.Companion.record(
    fileLabel: String,
    appTagPackages: List<String> = listOf(InstrumentationRegistry.getInstrumentation().targetContext.packageName),
    userspaceTracingPackage: String? = null,
    traceCallback: ((PerfettoTrace) -> Unit)? = null,
    block: () -> Unit
): Unit

Record a Perfetto System Trace for the specified block.

PerfettoTrace.record("myTrace") {
// content in here is traced to myTrace_<timestamp>.perfetto_trace
}

Reentrant Perfetto trace capture is not supported, so this API may not be combined with BenchmarkRule, MacrobenchmarkRule, or PerfettoTraceRule.

If the block throws, the trace is still captured and passed to traceCallback.

PerfettoTrace.Companion.record

@ExperimentalPerfettoCaptureApi
fun PerfettoTrace.Companion.record(
    fileLabel: String,
    config: PerfettoConfig,
    userspaceTracingPackage: String? = null,
    traceCallback: ((PerfettoTrace) -> Unit)? = null,
    block: () -> Unit
): Unit

Record a Perfetto System Trace for the specified block, with a fully custom Perfetto config, either text or binary.

PerfettoTrace.record("myTrace", config = """...""") {
// content in here is traced to myTrace_<timestamp>.perfetto_trace
}

Reentrant Perfetto trace capture is not supported, so this API may not be combined with BenchmarkRule, MacrobenchmarkRule, or PerfettoTraceRule.

If the block throws, the trace is still captured and passed to traceCallback.