Skip to main content Skip to docs navigation

Time Measure

measureTime, measureTimeWithResult & PerformanceCounter

Document not reviewed yet, might be outdated. Please, let us know if you find something invalid here.
On this page

Klock has utilities for mesuring time.

Measuring Time

As of now, most Klock features have been deprecated in favor of the standard library kotlin.time.

PerformanceCounter

This class offers a performance counter that will increase over time but that cannot be used as reference in time. Only can be used as relative time to compute deltas:

val start: Double = PerformanceCounter.microseconds
// ...
val end: Double = PerformanceCounter.microseconds
val elapsed: TimeSpan = (end - start).microseconds 
Was this article useful?