When collecting traces from the command line, a convenient way to open traces is to use the open_trace_in_ui script.
This can be used as follows:
curl -OL https://github.com/google/perfetto/raw/master/tools/open_trace_in_ui chmod +x open_trace_in_ui ./open_trace_in_ui -i /path/to/trace
If you already have a Perfetto checkout, the first two steps can be skipped. From the Perfetto root, run:
tools/open_trace_in_ui -i /path/to/trace
NOTE: JSON is considered a legacy trace format and is supported on a best-effort basis.
The Perfetto UI and trace processor do support overlapping B/E/X events, in compliance with the JSON spec. As stated in the spec, events are only allowed to perfecty nest.
Users are recommended to emit TrackEvent instead, Perfetto's native trace format. See this guide for how common JSON events can be represented using TrackEvent.
A common problem is that users want to use Perfetto analysis and visualization tooling but they don't want to instrument their program. This can be because Perfetto is not a good fit for their use-case or because they may already have an existing tracing system.
The recommended approach for this is to emit Perfetto's native TrackEvent proto format. A reference guide for this is available here.