Merging traces in the Perfetto UI

The Perfetto UI can open several trace files at once and merge them onto a single shared timeline: traces from two devices, an app trace next to a system trace, or several recordings of the same scenario. The merge dialog analyzes each file, lets you configure how they line up and which machine each belongs to, and warns before opening if any events would not fit on the shared timeline.

For merging in scripts or CI, see Merging traces with Trace Processor. For the underlying model, see How trace merging works.

When to use it

Use "at the same time" merging for traces that were captured concurrently and belong on one timeline. Typical cases:

Comparing runs from different points in time (before/after a regression) is a different task; the dialog's "Trace Comparison" tab is not yet implemented and links to the tracking GitHub issue.

Opening multiple traces

Three equivalent entry points:

Any of these opens the Open Multiple Traces dialog:

The merge dialog with two analyzed traces

Each file is analyzed in the background (its format, clocks and machines are detected using a throwaway in-browser Trace Processor instance) and gets a card showing its size and format. Use Add more traces to grow the set, or the trash icon to remove a file.

Configuring the merge

The dialog only shows controls where there is a real choice to make; a set of traces that align on their own just shows the green status and an Open Traces button.

Align to: the shared timeline

The Align to: row picks the reference everything else lines up against:

Per-file alignment

Traces that carry their own clock snapshots are placed automatically and say so on their card. For the rest, the Align: dropdown offers:

Machines

The Machine: dropdown attributes a file to a device. Keep Default to merge the trace onto the shared timeline alongside the host data, or use + Add machine... to create a named machine (for example "server") so the merged trace keeps that device's CPUs, processes and threads grouped separately. Pick the same machine for several files to put them all on that device.

Assigning a trace to a named machine

A file that is itself a multi-machine trace (recorded via traced_relay) instead shows a Machines (N): table for naming each embedded machine id; the names take effect once all ids are named.

The status panel

While you configure, the dialog re-runs a dry-run merge (in the browser, on a debounce) and reports the verdict:

A fixed offset that would drop events

Blocking errors (duplicate file names, files that failed to analyze, a non-integer offset) disable the Open Traces button until fixed. Two files with the same name cannot be merged; rename one on disk first.

Opening and reading the result

Open Traces loads the merged trace. Tracks from a named machine carry the machine name as a suffix, for example quote_service 4321 (server); tracks from the default machine are unsuffixed. Here a phone app's RPC: GetQuote slice lines up with the backend's HandleGetQuote work, recorded on a different machine, on one timeline:

A merged trace: a phone app and a backend server on one timeline

The timeline spans the union of all traces' recording windows, so two traces recorded minutes apart legitimately produce a long timeline with activity clustered at each end.

The Trace Info page (info icon in the sidebar) breaks stats, import errors and data losses down per input trace and machine.

Reusing a merge outside the UI

The dialog is built for one-off, interactive merges. If you are building a tool or system that generates several traces per run (a benchmarking framework tracing a client and a server, a multi-device test harness), you probably do not want your users to reconfigure this dialog for every capture. Instead have the tool bundle its traces and a trace manifest into one archive: that archive opens directly, in the UI or in trace_processor, with the merge pre-configured.

The dialog's footer helps bootstrap exactly that:

Next steps