Added samples for the kotlin.system package (measureTime* functions)
Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
This commit is contained in:
committed by
Ilya Gorbunov
parent
15381c4662
commit
f48f7c6dca
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,8 @@ import kotlin.contracts.*
|
||||
|
||||
/**
|
||||
* Executes the given [block] and returns elapsed time in milliseconds.
|
||||
*
|
||||
* @sample samples.system.Timing.measureBlockTimeMillis
|
||||
*/
|
||||
public inline fun measureTimeMillis(block: () -> Unit): Long {
|
||||
contract {
|
||||
@@ -22,6 +24,8 @@ public inline fun measureTimeMillis(block: () -> Unit): Long {
|
||||
|
||||
/**
|
||||
* Executes the given [block] and returns elapsed time in nanoseconds.
|
||||
*
|
||||
* @sample samples.system.Timing.measureBlockNanoTime
|
||||
*/
|
||||
public inline fun measureNanoTime(block: () -> Unit): Long {
|
||||
contract {
|
||||
|
||||
Reference in New Issue
Block a user