Skip to content

Commit b463a44

Browse files
authored
Benchmarks: fix OOM crash on a real iOS device. (#5209)
## Release Notes N/A
1 parent 1e1810c commit b463a44

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

benchmarks/multiplatform/benchmarks/src/commonMain/kotlin/MeasureComposable.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,24 @@ suspend fun measureComposable(
5757
repeat(warmupCount) {
5858
scene.render(canvas, it * nanosPerFrame)
5959
surface.flushAndSubmit(false)
60+
graphicsContext?.awaitGPUCompletion()
6061
}
6162

62-
graphicsContext?.awaitGPUCompletion()
63-
6463
runGC()
6564

6665
var renderTime = Duration.ZERO
66+
var gpuTime = Duration.ZERO
6767
if (Args.isModeEnabled(Mode.CPU)) {
6868
renderTime = measureTime {
6969
repeat(frameCount) {
7070
scene.render(canvas, it * nanosPerFrame)
7171
surface.flushAndSubmit(false)
72+
gpuTime += measureTime {
73+
graphicsContext?.awaitGPUCompletion()
74+
}
7275
}
7376
}
74-
graphicsContext?.awaitGPUCompletion()
77+
renderTime -= gpuTime
7578
}
7679

7780
val frames = MutableList(frameCount) {

0 commit comments

Comments
 (0)