Skip to content

Commit fc24c04

Browse files
committed
Rename measureTime with measureNanoseconds
1 parent 072daa2 commit fc24c04

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

runtime/commonMain/src/kotlinx/benchmark/CommonSuiteExecutor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ abstract class CommonSuiteExecutor(
7979
var elapsedTime = 0L
8080
val benchmarkIterationTime = configuration.iterationTime * configuration.iterationTimeUnit.toMultiplier()
8181
do {
82-
val subIterationDuration = measureTime(body)
82+
val subIterationDuration = measureNanoseconds(body)
8383
elapsedTime += subIterationDuration
8484
iterations++
8585
} while (elapsedTime < benchmarkIterationTime)
@@ -150,7 +150,7 @@ abstract class CommonSuiteExecutor(
150150
cycles: Int
151151
): () -> Long = wrapBenchmarkFunction(instance, benchmark) { payload ->
152152
var cycle = cycles
153-
measureTime {
153+
measureNanoseconds {
154154
while(cycle-- > 0) {
155155
payload()
156156
}

runtime/commonMain/src/kotlinx/benchmark/Utils.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,4 @@ internal expect fun String.readFile(): String
44

55
internal expect fun String.writeFile(text: String)
66

7-
/*
8-
* Measure time in nanoseconds for given body
9-
*/
10-
internal expect inline fun measureTime(block: () -> Unit): Long
7+
internal expect inline fun measureNanoseconds(block: () -> Unit): Long

runtime/jsMain/src/kotlinx/benchmark/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ internal val jsEngineSupport: JsEngineSupport by lazy {
2828
if (isD8) D8EngineSupport else NodeJsEngineSupport
2929
}
3030

31-
internal actual inline fun measureTime(block: () -> Unit): Long =
31+
internal actual inline fun measureNanoseconds(block: () -> Unit): Long =
3232
if (isD8) d8MeasureTime(block) else nodeJsMeasureTime(block)

runtime/jvmMain/src/kotlinx/benchmark/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ internal actual fun String.writeFile(text: String) {
1515
File(this).writeText(text)
1616
}
1717

18-
internal actual inline fun measureTime(block: () -> Unit): Long = TODO("Not implemented for this platform")
18+
internal actual inline fun measureNanoseconds(block: () -> Unit): Long = TODO("Not implemented for this platform")

runtime/nativeMain/src/kotlinx/benchmark/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ internal fun String.parseBenchmarkConfig(): NativeExecutor.BenchmarkRun {
6262
return NativeExecutor.BenchmarkRun(name, configuration, parameters)
6363
}
6464

65-
internal actual inline fun measureTime(block: () -> Unit): Long = TODO("Not implemented for this platform")
65+
internal actual inline fun measureNanoseconds(block: () -> Unit): Long = TODO("Not implemented for this platform")

runtime/wasmMain/src/kotlinx/benchmark/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ internal val jsEngineSupport: JsEngineSupport by lazy {
3030

3131
internal external interface ExternalInterfaceType
3232

33-
internal actual inline fun measureTime(block: () -> Unit): Long =
33+
internal actual inline fun measureNanoseconds(block: () -> Unit): Long =
3434
if (isD8) d8MeasureTime(block) else nodeJsMeasureTime(block)

0 commit comments

Comments
 (0)