Skip to content

Commit 7559472

Browse files
committed
Fix composition tracing metric name
1 parent b4469e5 commit 7559472

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

MacrobenchmarkSample/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ To get composition tracing when running a macrobenchmark, you also need to use `
4848
You can check the `Scroll List With Composition Tracing` run configuration that is part of the project,
4949
which runs the scroll compose list benchmark while also recording the information on composition.
5050

51+
It produces results like in the following table:
52+
```
53+
FrameTimingBenchmark_scrollComposeList
54+
%EntryRow (%Count min 5.0, median 6.0, max 6.0
55+
%EntryRow (%Ms min 10.2, median 11.8, max 16.2
56+
EntryRowCustomTraceCount min 5.0, median 6.0, max 6.0
57+
EntryRowCustomTraceMs min 10.0, median 11.7, max 16.1
58+
frameDurationCpuMs P50 4.8, P90 6.8, P95 8.9, P99 15.3
59+
frameOverrunMs P50 -9.2, P90 -1.9, P95 266.9, P99 310.9
60+
Traces: Iteration 0 1 2 3 4 5 6 7 8 9
61+
```
62+
63+
And from there you can also delve into the system trace, which shows information on composition:
5164
![System trace with composition tracing](media/composition-tracing.png)
5265

5366
### Reporting Issues

MacrobenchmarkSample/app/src/main/java/com/example/macrobenchmark/target/activity/clicklatency/ComposeActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class ComposeActivity : ComponentActivity() {
127127
}
128128

129129
@Composable
130-
private fun EntryRow(entry: Entry, modifier: Modifier = Modifier) = trace("EntryRow") {
130+
private fun EntryRow(entry: Entry, modifier: Modifier = Modifier) = trace("EntryRowCustomTrace") {
131131
Card(modifier = modifier) {
132132
Row(verticalAlignment = Alignment.CenterVertically) {
133133
Text(

MacrobenchmarkSample/macrobenchmark/src/main/java/com/example/macrobenchmark/benchmark/frames/FrameTimingBenchmark.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ class FrameTimingBenchmark {
8181
// Measure custom trace sections by name EntryRow (which is added to the EntryRow composable).
8282
// Mode.Sum measure combined duration and also how many times it occurred in the trace.
8383
// This way, you can estimate whether a composable recomposes more than it should.
84-
TraceSectionMetric("EntryRow", TraceSectionMetric.Mode.Sum),
84+
TraceSectionMetric("EntryRowCustomTrace", TraceSectionMetric.Mode.Sum),
8585
// This trace section takes into account the SQL wildcard character %,
8686
// which can find trace sections without knowing the full name.
8787
// This way, you can measure composables produced by the composition tracing
8888
// and measure how long they took and how many times they recomposed.
8989
// WARNING: This metric only shows results when running with composition tracing, otherwise it won't be visible in the outputs.
90-
TraceSectionMetric("%.EntryRow%", TraceSectionMetric.Mode.Sum),
90+
TraceSectionMetric("%EntryRow (%", TraceSectionMetric.Mode.Sum),
9191
),
9292
// Try switching to different compilation modes to see the effect
9393
// it has on frame timing metrics.

0 commit comments

Comments
 (0)