When I want to measure the drawing time for custom view, I can use the below function.
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
val elapsedTime= measureTimeMillis {
myDeepHierarchyCustomeDrawing.draw(canvas)
}
Log.d("Tracking", "Time used $elapsedTime")
}
However, for Jetpack Compose, when I draw the view, the below elapse time is no longer accurate.
The function seems to get spawn off as a different thread, hence the elapsed time to finish before the drawing finish.
@Composable
override fun Content() {
val elapsedTime= measureTimeMillis {
MyDeepHierarchyJetpackComposeDrawing()
}
Log.d("Tracking", "Time used $elapsedTime")
}
Hence my question is, how can I measure the time used by Jetpack Compose to complete a complex deep hierarchical jetpack compose function drawing?