glean / mozilla.telemetry.glean.private / TimingDistributionMetricType / measure

measure

fun <U> measure(funcToMeasure: () -> U): U

Convenience method to simplify measuring a function or block of code.

If the measured function throws, the measurement is canceled and the exception rethrown.