Find the cause of UI jank in a recorded trace
Wann einsetzen: User report: 'the app stutters when I scroll'. You captured a Perfetto trace. Now what?
Voraussetzungen
- Perfetto .pftrace file — perfetto / systrace / Android Studio Profiler
Ablauf
-
Point MCP at the traceOpen /tmp/jank.pftrace for process com.example.app. Find jank frames — anything over 16.67ms on the main thread.✓ Kopiert→ List of janky frames with slice context
-
Attribute the causeFor the top 3 janky frames, what slice dominated? What was the main thread doing when the frame missed?✓ Kopiert→ Cause per frame
-
Propose fixBased on these bottlenecks, suggest concrete changes (move off main, cache, etc.).✓ Kopiert→ Fix plan
Ergebnis: Jank root cause identified without staring at the timeline UI.
Fallstricke
- Sample interval too coarse — missing short hot methods — Re-record with higher sampling frequency when needed