Skip to main content

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

The sidebar provides access to your traces and Perfetto features:
SectionDescription
TracesDropdown to select from previously uploaded traces
FeaturesQuick access buttons for Timeline, Query, Viz, Metrics, and Stats views
DownloadSave the current trace to your local machine
Click the hamburger menu (☰) in the header to show/hide the sidebar. You can collapse it for more viewing space.

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:
-- Find the 10 longest events
SELECT name, dur/1e6 as duration_ms
FROM slice
ORDER BY dur DESC
LIMIT 10
-- Group events by category
SELECT category, COUNT(*) as count, SUM(dur)/1e6 as total_ms
FROM slice
GROUP BY category
ORDER BY total_ms DESC
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/:
.wafer/
└── traces/
    └── trace_1234567890_abc123/
        ├── meta.json       # Trace metadata
        └── mytrace.json    # Original trace file

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:
  1. Open the trace dropdown in the sidebar
  2. Hover over the trace you want to delete
  3. Click the × button that appears
Deleting a trace permanently removes it from your workspace. This cannot be undone.

Tips for Analysis

Zoom out to see the entire trace first. Look for patterns: are there long gaps? Repeated expensive operations? Uneven distribution of work?
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?”
Gaps in the timeline often indicate waiting—for I/O, locks, or scheduling. These are often easier to optimize than speeding up compute.
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

Next Steps