Created
July 13, 2020 23:37
-
-
Save toantran-ea/0790203f2827d2d75ffa9ca4d7871f24 to your computer and use it in GitHub Desktop.
measureNanoTime.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Executes the given [block] and returns elapsed time in nanoseconds. | |
*/ | |
public inline fun measureNanoTime(block: () -> Unit): Long { | |
val start = System.nanoTime() | |
block() | |
return System.nanoTime() - start | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment