File tree Expand file tree Collapse file tree 6 files changed +7
-10
lines changed
commonMain/src/kotlinx/benchmark
jsMain/src/kotlinx/benchmark
jvmMain/src/kotlinx/benchmark
nativeMain/src/kotlinx/benchmark
wasmMain/src/kotlinx/benchmark Expand file tree Collapse file tree 6 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ abstract class CommonSuiteExecutor(
79
79
var elapsedTime = 0L
80
80
val benchmarkIterationTime = configuration.iterationTime * configuration.iterationTimeUnit.toMultiplier()
81
81
do {
82
- val subIterationDuration = measureTime (body)
82
+ val subIterationDuration = measureNanoseconds (body)
83
83
elapsedTime + = subIterationDuration
84
84
iterations++
85
85
} while (elapsedTime < benchmarkIterationTime)
@@ -150,7 +150,7 @@ abstract class CommonSuiteExecutor(
150
150
cycles : Int
151
151
): () -> Long = wrapBenchmarkFunction(instance, benchmark) { payload ->
152
152
var cycle = cycles
153
- measureTime {
153
+ measureNanoseconds {
154
154
while (cycle-- > 0 ) {
155
155
payload()
156
156
}
Original file line number Diff line number Diff line change @@ -4,7 +4,4 @@ internal expect fun String.readFile(): String
4
4
5
5
internal expect fun String.writeFile (text : String )
6
6
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
Original file line number Diff line number Diff line change @@ -28,5 +28,5 @@ internal val jsEngineSupport: JsEngineSupport by lazy {
28
28
if (isD8) D8EngineSupport else NodeJsEngineSupport
29
29
}
30
30
31
- internal actual inline fun measureTime (block : () -> Unit ): Long =
31
+ internal actual inline fun measureNanoseconds (block : () -> Unit ): Long =
32
32
if (isD8) d8MeasureTime(block) else nodeJsMeasureTime(block)
Original file line number Diff line number Diff line change @@ -15,4 +15,4 @@ internal actual fun String.writeFile(text: String) {
15
15
File (this ).writeText(text)
16
16
}
17
17
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" )
Original file line number Diff line number Diff line change @@ -62,4 +62,4 @@ internal fun String.parseBenchmarkConfig(): NativeExecutor.BenchmarkRun {
62
62
return NativeExecutor .BenchmarkRun (name, configuration, parameters)
63
63
}
64
64
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" )
Original file line number Diff line number Diff line change @@ -30,5 +30,5 @@ internal val jsEngineSupport: JsEngineSupport by lazy {
30
30
31
31
internal external interface ExternalInterfaceType
32
32
33
- internal actual inline fun measureTime (block : () -> Unit ): Long =
33
+ internal actual inline fun measureNanoseconds (block : () -> Unit ): Long =
34
34
if (isD8) d8MeasureTime(block) else nodeJsMeasureTime(block)
You can’t perform that action at this time.
0 commit comments