FlowFan
11/11/2024, 10:02 AMKahloun Hamdi
11/11/2024, 10:19 AM@Composable
fun MeasureRenderingTime() {
// Start measuring when the composable is first composed
val startTime = remember { Instant.now() }
LaunchedEffect(Unit) {
// Perform your action and then measure the time
val endTime = Instant.now()
val duration = ChronoUnit.MILLIS.between(startTime, endTime)
// Log the duration
println("Rendering time: $duration ms")
}
// Content of the composable
Column {
Button(onClick = {}) {
Text("Button 1")
}
Button(onClick = {}) {
Text("Button 2")
}
}
}
@Preview
@Composable
fun PreviewMeasureRenderingTime() {
MeasureRenderingTime()
}