Metric.Measurement


@ExperimentalMetricApi
data class Metric.Measurement


Represents a Metric's measurement of a single iteration.

To validate results in tests, use assertEqualMeasurements

Summary

Public constructors

Measurement(name: String, data: Double)

Represents a measurement with a single value captured per iteration.

Measurement(name: String, dataSamples: List<Double>)

Represents a measurement with a value sampled an arbitrary number of times per iteration.

Public properties

List<Double>

Measurement values captured by the metric, length constraints defined by requireSingleValue.

String

Unique name of the metric, should be camel case with abbreviated suffix, e.g. startTimeNs

Boolean

True if the data param is a single value per measurement, false if it contains an arbitrary number of samples.

Public constructors

Measurement

Added in 1.2.0
Measurement(name: String, data: Double)

Represents a measurement with a single value captured per iteration.

For example, in a startup Macrobenchmark, StartupTimingMetric returns a single measurement for timeToInitialDisplayMs.

Measurement

Added in 1.2.0
Measurement(name: String, dataSamples: List<Double>)

Represents a measurement with a value sampled an arbitrary number of times per iteration.

For example, in a jank Macrobenchmark, FrameTimingMetric can return multiple measurements for frameOverrunMs - one for each observed frame.

When measurements are merged across multiple iterations, percentiles are extracted from the total pool of samples: P50, P90, P95, and P99.

Public properties

data

Added in 1.2.0
val dataList<Double>

Measurement values captured by the metric, length constraints defined by requireSingleValue.

name

Added in 1.2.0
val nameString

Unique name of the metric, should be camel case with abbreviated suffix, e.g. startTimeNs

requireSingleValue

Added in 1.2.0
val requireSingleValueBoolean

True if the data param is a single value per measurement, false if it contains an arbitrary number of samples.