Find the cause of UI jank in a recorded trace
Когда использовать: User report: 'the app stutters when I scroll'. You captured a Perfetto trace. Now what?
Предварительные требования
- Perfetto .pftrace file — perfetto / systrace / Android Studio Profiler
Поток
-
Point MCP at the traceOpen /tmp/jank.pftrace for process com.example.app. Find jank frames — anything over 16.67ms on the main thread.✓ Скопировано→ 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?✓ Скопировано→ Cause per frame
-
Propose fixBased on these bottlenecks, suggest concrete changes (move off main, cache, etc.).✓ Скопировано→ Fix plan
Итог: Jank root cause identified without staring at the timeline UI.
Подводные камни
- Sample interval too coarse — missing short hot methods — Re-record with higher sampling frequency when needed