Hi, how can I effectively measure the complete Jet...
# compose
e
Hi, how can I effectively measure the complete Jetpack Compose rendering time? I use the function below, but it is not working, since the function call completed before the rendering of the UI is completed.
Copy code
@Composable
    override fun Content() {
        val elapsedTime= measureTimeMillis {
            MyDeepHierarchyJetpackComposeDrawing()
        }
        Log.d("Tracking", "Time used $elapsedTime")
    }
Thanks!
w
I had this same problem a while back; a global layout listener gave a pretty good approximation of an endpoint. Profiling also gave a good picture of where things fit into the overall flow, though it impacted the timing of things pretty significantly.
r
systrace/perfetto will give you good timings in various parts of the system with very little overhead
It's definitely the better way to measure things like frame time
s
I'm using Macrobenchmark library for that task. It produces nice reports and raw Perfetto traces.