I’m looking for a way to measure the time it takes...
# compose
m
I’m looking for a way to measure the time it takes from the start of a composition until drawing on the canvas is finished. I’m utilizing
Modifier.drawWithContent
right now (see 🧵) but I’m pretty sure there’s a better way. Any help appreciated!
Here’s my current approach:
Copy code
@Composable
fun Example() {
    val compositionStartTime = SystemClock.elapsedRealtimeNanos()
    Box(modifier = Modifier
        .drawWithContent {
            drawContent()
            val duration = SystemClock.elapsedRealtimeNanos() - compositionStartTime
            Log.d("TEST", "total duration to render: ${duration}ns")
        }) {
        // content
    }
}