A Busy Android App Developers' Guide to Perfetto
summary
Perfetto traces collected via the ADB websocket and a ring buffer reveal CPU spikes, frame drops and a high-frequency binder/job churn during app startup; using call-stack sampling and a pinned ENQ debug track surfaces a weather_update_worker.doWork task that repeatedly enqueues maintenance work, creating an expensive recursive WorkManager loop. Recording choices matter (don’t over-record), native tracing overhead is ~1,200 ns for platform API versus about ~120 ns with the new tracing library, and the trace-driven hypothesis directly points to the root cause in the code.
AI-written summary · about
chapters (11)
- 0:00Perfetto for Android apps
- 7:07Recording traces with Perfetto
- 10:58Analyzing Perfetto traces
- 16:34Startup performance issues
- 19:41Call stack sampling for uninstrumented code
- 24:16Improving tracing with AndroidX Tracing
- 27:48Tracing Driver library
- 31:21Context propagation in coroutines
- 33:27Automating with Perfetto macros
- 34:32Extending Perfetto with plugins
- 36:44Perfetto resources and next steps
related talks
13mPerfetto Your App for Perfect Performance
39mDeep-Diving Android Performance with Perfetto
35mIn Search of Performance: the Subtle Art of Android Profiling
34mClient Tracing At Scale
43mAdvanced System Profiling Tracing and Trace Analysis with Perfetto
27mIntroducing the Mobile PerfSDK
40mDebugging Android Performance at Scale: Lessons from Building Datadog's Mobile Profiler
43mPerformance in a Kotlin World
