MicrobenchmarkConfig


@ExperimentalBenchmarkConfigApi
class MicrobenchmarkConfig


Experimental config object for microbenchmarks for defining custom metrics, tracing behavior, and profiling, which overrides options set in instrumentation arguments.

Summary

Public constructors

MicrobenchmarkConfig(
    metrics: List<MetricCapture>,
    traceAppTagEnabled: Boolean,
    perfettoSdkTracingEnabled: Boolean,
    profiler: ProfilerConfig?,
    warmupCount: Int?,
    measurementCount: Int?
)

Public properties

Int?

Number of measurements to perform, leave null for default behavior.

List<MetricCapture>

Timing metrics for primary phase, post-warmup

Boolean

Set to true to enable capture of tracing-perfetto trace events, such as in Compose composition tracing.

ProfilerConfig?

Optional profiler to be used after the primary timing phase.

Boolean

Set to true to enable capture of trace("foo") {} blocks in the output Perfetto trace.

Int?

Number of non-measured warmup iterations to perform, leave null to determine automatically.

Public constructors

MicrobenchmarkConfig

MicrobenchmarkConfig(
    metrics: List<MetricCapture> = if (Arguments.cpuEventCounterMask != 0) { listOf( TimeCapture(), CpuEventCounterCapture( cpuEventCounter = MicrobenchmarkPhase.cpuEventCounter, mask = Arguments.cpuEventCounterMask, validateMeasurements = true, ), ) } else { listOf(TimeCapture()) },
    traceAppTagEnabled: Boolean = false,
    perfettoSdkTracingEnabled: Boolean = false,
    profiler: ProfilerConfig? = null,
    warmupCount: Int? = null,
    measurementCount: Int? = null
)

Public properties

measurementCount

Added in 1.4.0
val measurementCount: Int?

Number of measurements to perform, leave null for default behavior.

metrics

Added in 1.2.0
val metrics: List<MetricCapture>

Timing metrics for primary phase, post-warmup

Defaults to TimeCapture.

perfettoSdkTracingEnabled

Added in 1.3.0
val perfettoSdkTracingEnabled: Boolean

Set to true to enable capture of tracing-perfetto trace events, such as in Compose composition tracing.

Defaults to false to minimize interference.

profiler

Added in 1.2.0
val profiler: ProfilerConfig?

Optional profiler to be used after the primary timing phase.

traceAppTagEnabled

Added in 1.3.0
val traceAppTagEnabled: Boolean

Set to true to enable capture of trace("foo") {} blocks in the output Perfetto trace.

Defaults to false to minimize interference.

warmupCount

Added in 1.4.0
val warmupCount: Int?

Number of non-measured warmup iterations to perform, leave null to determine automatically.