W3cubDocs

/Kotlin

measureTimedValue

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalTime inline fun <T> measureTimedValue(
    block: () -> T
): TimedValue<T>

Executes the given function block and returns an instance of TimedValue class, containing both the result of the function execution and the duration of elapsed time interval.

The elapsed time is measured with TimeSource.Monotonic.

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalTime inline fun <T> TimeSource.measureTimedValue(
    block: () -> T
): TimedValue<T>

Executes the given block and returns an instance of TimedValue class, containing both the result of function execution and the duration of elapsed time interval.

The elapsed time is measured with the specified this TimeSource instance.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/measure-timed-value.html