Perfetto on the Web: Interface Overview, Basic Operations, and Practical Tips for Android Performance Analysis
This article introduces the Perfetto web UI, explains its four main sections, walks through essential navigation shortcuts, and shares practical techniques such as viewing wake‑up sources, critical paths, pinning threads, inspecting CPU info, buffer usage, timeouts, and logs to help Android developers efficiently analyze performance traces.
Perfetto View Interface
After capturing a Perfetto trace, you can open it at ui.perfetto.dev (or the script‑provided link). The initial view shows a white area where you can drag‑and‑drop a trace file or use the "Open trace file" button.
Perfetto Trace Interface
The trace view is divided into four areas:
Right‑most operation panel : contains Current Trace controls such as Show timeline, Query (SQL editor), Metrics, and Info & stats.
Top information and operation bar : mainly displays the timeline.
Central trace content area : shows CPU sections, Ftrace events, and per‑process threads (including Input, Binder, Memory, Buffer, etc.).
Bottom information panel : displays details of the selected task, including logs and ftrace events.
Although the UI may look cluttered at first, it becomes very powerful once you get used to it.
Basic Operations
Perfetto handles large traces smoothly (e.g., 500 MB) compared to Systrace. Navigation shortcuts are similar to Systrace: w/s to zoom, a/d to pan, mouse click to select. Detailed shortcuts are listed in the lower‑left documentation.
f : zoom into the selected region.
m : temporary mark a region (press Esc or select another slice to clear).
Shift + m : persistent mark that stays until manually removed.
Delete persistent mark : select the slice, go to Current Selection tab, click Remove .
q : toggle the information tab on/off.
Insert flag : click the flag icon that appears at the top of the trace to mark an event.
Remove flag : select the flag and click Remove in the lower‑right corner.
Perfetto Usage Tips
Viewing Wake‑up Sources
Click the Runnable state next to a task to see its wake‑up source, previous state, and next state. Alternatively, click the Running state and follow the arrow to the CPU Info area for a continuous view of wake‑up chains.
Viewing Critical Path (Task)
Select a task, click Running , then choose Critical path in the info panel to see all dependent tasks that must complete before the selected one runs.
Pin to Top
Click the pin icon on the left of a thread to keep it at the top of the list, making it easier to follow related threads (e.g., from App to SurfaceFlinger).
CPU Info Area Task Highlight
Hovering over a task in the CPU Info panel highlights all other tasks belonging to the same thread, useful for quick thread‑level analysis.
Viewing Buffer Consumption
The Actual Timeline under the App Process shows which SurfaceFlinger frame consumes each buffer, helping you track buffer lifecycles.
Quickly Detecting App Execution Timeouts
Compare Expected Timeline with Actual Timeline ; mismatches indicate timeouts. Clicking the red segment in the Actual Timeline reveals the frame‑drop cause.
Viewing Logs in Perfetto
Switch to the Android Logs tab; hovering over a log line draws a vertical line on the timeline, aligning the log with other events. The Ftrace events tab provides similar timing for ftrace entries.
Analyzing Thread Running Information
Drag to select a region in the CPU State column to see the proportion of Running, Runnable, Sleep, and Uninterruptible Sleep states, which is especially helpful when analyzing app startup performance.
Conclusion
The article covered Perfetto's basic UI, essential operations, and several handy tips. Google continues to evolve Perfetto, so stay tuned for new features that may further simplify Android performance debugging.
Rare Earth Juejin Tech Community
Juejin, a tech community that helps developers grow.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.