Reading Perfetto, then handing it to an agent.
Agents write a growing share of it. A slow frame doesn't fail a test, so it ships. The fix is boring: measure on a schedule.
Press record, use the app, stop. Then scrub back to the moment it felt slow and see what every thread was doing.
Open source, from Google. The recorder already ships on your phone.
A profiler only sees your code. Logcat only prints what you logged. Perfetto records the whole system.
Then read slice names. Grep one in your code. No match means it's a framework span, and that tells you something too.
Compose Multiplatform. A release build, on a phone from 2017 that runs Android 10. Debug builds run 2 to 5x slower. A release build can still mislead: check what it ran.
Three things we'll measure: what it draws when nobody touches it, cold start, and binder/IPC.
An idle screen should draw nothing. Two of these draw 60 frames a second, and each frame costs about 11 ms on the RenderThread.
Release build, top 8 by total time (13_startup_top_slices). This run took 814 ms to first frame. The median of 10 is 684 ms.
51 ms asleep against 11 ms running. The other process isn't slow. The main thread is parked, waiting for replies, 318 times.
This part works on any app.
This is the app's cold-start capture. Trusted, and it says what it can't answer. unknown is never a pass. Below trusted, every finding is marked directional_only.
Running means your code is slow. Waiting means it was blocked, and profiling your own code will find nothing.
A real capture, with the app's name replaced. Go live only with a public trace.
Every frame owns a deadline. Miss it, and Perfetto can tell you if it was the app or SurfaceFlinger.
An illustration. The app in this talk ran on Android 10, which records no frame deadlines, so it has no chart like this one.
Five phases from process fork to first frame.
TTID is the time to the first drawn frame. Even an empty loading screen counts, so it can be gamed. TTFD is the time to the frame after reportFullyDrawn(). The app has to say "the content is on screen now", so it is harder to fake.
Shares from one run: bindApplication 414 ms and the first frame 273 ms of 814 ms. The two small blocks are not measured separately.
The phone said speed-profile, and the JIT still ran for 2 seconds. The profile wasn't stale. It had never been applied.
| Median of 10 | As installed | Profile applied | Change | Verdict |
|---|---|---|---|---|
| JIT compile | 2,169 ms | 118 ms | -95% | clear |
| Cold start TTID | 674 ms | 487 ms | -28% | clear |
| Main thread running | 80% | 50% | -37% | clear |
| Main-thread binder | 120 ms | 128 ms | +7% | noise |
Installed with adb, the label is set before the app first runs. The profile is copied in on first launch and only counts after the next compile. Launch once, send the INSTALL_PROFILE broadcast, compile, then measure. The label read speed-profile on both sides.
Macrobenchmark saves a Perfetto trace for every iteration, so one run gives you both.
Watch an agent run the same one.
Show the issue. The four questions, as SQL, ranked worst-first.
SKILL.md steps 0 to 4: capture, triage, map slices to code
Baseline, change one thing, re-measure, prove it.
SKILL.md steps 5 and 6: fix one thing, re-measure
The top of the list from one cold start. The same run also writes fix_plan.md: these, turned into changes to review, in order.
The skill drew this page. The charts are measured. Each What it means line is the skill's own reading of them, so check it like you would a colleague's.
Thread states and frames keep Perfetto's colours. Sample: the repo's debug-build fixture. Open it.
So the skill reads the code instead: the Application class, the launcher Activity, the first screen. It looks there for causes that match the findings, and lists them with file and line.
| What happened | What it said then | What it says now |
|---|---|---|
| Captured a debug build by mistake | 9 confident findings, no warning | capture refuses · report: directional_only |
| Capture missed the app launch | no startup findings, which reads as "fine" | blocker: startup capture missed the launch |
| Empty health vs zero coverage | both look like "no data" | explicit pass / missing |
| Captured on an Android 10 phone | 528 frames, 100% on time, "trusted" | late frames: not measured, and why |
| Installed the build with adb | speed-profile, so the profile is stale | the label is not proof: apply it, then measure |
The first three are checks in the repo that replay the original data through today's code. Two pass. The third needs a debug capture we can publish. The last two are pinned by tests.


Medians of 10 cold starts. Release build, compiled speed-profile, same phone. Keep the before APK: the next build overwrites it.
The code audit read the startup path and pointed at notification channel set-up: 1 delete and 8 creates on every launch, on the main thread. Nine binder calls. The change: do it once per app version. Nothing else changed.
| Median of 10 | Before (range) | After (range) | Change | Verdict |
|---|---|---|---|---|
| Cold start TTID | 683.7 ms (660 to 835) | 673.6 ms (651 to 683) | -1% | noise |
| Main-thread binder | 104.0 ms (95 to 172) | 119.6 ms (100 to 153) | +15% | noise |
| JIT compile | 2,115 ms | 2,169 ms | +3% | noise |
Nine calls out of about 320. It was never going to clear a spread of 95 to 172 ms. The comparison said so before anyone called it a win.
| Screen | Frames in 10 s, untouched | Reading |
|---|---|---|
| Home | 603 | keeps drawing |
| A list screen | 604 | keeps drawing |
| A browse screen | 13 | one burst while it loads, then idle |
All three share the app's shell: the bottom bar, the scaffold. So it isn't the shell. It is something the first two screens have and the third doesn't.
An animated value that is read in composition recomposes on every frame. This one doesn't. So it is read in a draw block, and composition tracing can't name it. The way in is to switch one suspect off and count frames.
Where it stands: found, measured, narrowed to two screens. Not fixed yet. The check is one number: 603 frames, down to about 13.
Everything in this talk, runnable today.
github.com/aldefy/perfetto-android-skills (the skill, installable)
Don't outsource judgment about your own codebase to a tool that has never seen it. Read enough traces yourself that you can tell when the agent's ranking is wrong. That is how it gets better.
Adit Lal, CTO & co-founder, Travv.world
Rivu Chakraborty, Android & Kotlin GDE, Sarvam
A profiler tells you your function was slow. A trace tells you why the thread wasn't running at all.
Checks trace_processor's own error/data-loss stats. Any row here means the buffer dropped data or a source failed, and every number downstream is wrong.
Counts rows from every data source the trace needs. A 0 in any column means that whole CLASS of question is unanswerable with this capture.
Layout, measure, draw commands. Slow here = your view hierarchy or your code.
Actual GL/Vulkan submission. Slow here = shader compiles, GPU work, driver.
The fix phase starts here, with a baseline.
One run on a debuggable build. It shows the tool runs, nothing more.
That is the division of labour.