Analyzing Perfetto Traces
Learn how to open, navigate, and understand trace data using Wafer’s embedded Perfetto viewer.Opening a Trace
1
Select Perfetto
Open the Wafer panel and select Perfetto from the tool dropdown.
2
Click Upload Trace
Click the Upload Trace button in the header.
3
Choose Your Trace
Navigate to and select a trace file (
.json or .json.gz). The trace will load and display in the viewer.Understanding the Interface
Sidebar
The sidebar provides access to your traces and Perfetto features:| Section | Description |
|---|---|
| Traces | Dropdown to select from previously uploaded traces |
| Features | Quick access buttons for Timeline, Query, Viz, Metrics, and Stats views |
| Download | Save the current trace to your local machine |
Timeline View
The default view shows an interactive timeline of all trace events:- Zoom — Scroll wheel or pinch to zoom in/out on time ranges
- Pan — Click and drag to move through the timeline
- Select — Click on events to see details in the bottom panel
- Measure — Click and drag to measure time intervals
Track Organization
Traces are organized into tracks (rows) based on:- Process — Each process gets its own section
- Thread — Threads within a process are shown as sub-tracks
- Categories — Events are colored by category (GPU, CPU, I/O, etc.)
Perfetto Features
Timeline
The main visualization mode. Shows all events on a scrollable, zoomable timeline. Use this to:- Get an overview of your trace
- Find long-running operations
- Identify gaps and bottlenecks
- Understand event relationships
Query (SQL)
Run SQL queries directly on your trace data. Perfetto stores trace data in a SQLite-like database that you can query:The Query tab has autocomplete and syntax highlighting. See Perfetto’s SQL documentation for available tables and columns.
Visualization
Create custom visualizations from your trace data. Build charts, graphs, and dashboards to surface specific patterns.Metrics
View pre-computed metrics about your trace:- Event counts by category
- Duration statistics
- Thread utilization
- Memory usage patterns
Stats
General information about the loaded trace:- Trace duration
- Number of events
- Processes and threads
- Metadata
Managing Traces
Trace Storage
Uploaded traces are stored in your workspace under.wafer/traces/:
Trace Metadata
Each trace stores metadata including:- Original filename — The name when uploaded
- Timestamp — When it was uploaded
- Size — File size in bytes
- Git commit — The commit hash when uploaded (if in a git repo)
Deleting Traces
To delete a trace:- Open the trace dropdown in the sidebar
- Hover over the trace you want to delete
- Click the × button that appears
Tips for Analysis
Start with the big picture
Start with the big picture
Zoom out to see the entire trace first. Look for patterns: are there long gaps? Repeated expensive operations? Uneven distribution of work?
Use SQL for specific questions
Use SQL for specific questions
The timeline shows everything, but SQL queries let you ask specific questions. “What’s the slowest operation?” “How many times does X happen?” “What’s the total time in category Y?”
Look for gaps
Look for gaps
Gaps in the timeline often indicate waiting—for I/O, locks, or scheduling. These are often easier to optimize than speeding up compute.
Compare across runs
Compare across runs
Upload multiple traces and compare them side-by-side. Did your optimization help? Did it introduce new bottlenecks?
Exporting Results
You can export data from Perfetto:- Download trace — Save the full trace file using the Download button in the sidebar
- Copy query results — Copy SQL query results from the Query tab
- Screenshot — Use browser screenshots to capture timeline views