xref: /aosp_15_r20/external/perfetto/docs/faq.md (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1*6dbdd20aSAndroid Build Coastguard Worker# Frequently Asked Questions
2*6dbdd20aSAndroid Build Coastguard Worker
3*6dbdd20aSAndroid Build Coastguard Worker## How do I open trace in UI from command line?
4*6dbdd20aSAndroid Build Coastguard Worker
5*6dbdd20aSAndroid Build Coastguard WorkerWhen collecting traces from the command line, a convenient way to open traces
6*6dbdd20aSAndroid Build Coastguard Workeris to use the [open\_trace\_in\_ui script](/tools/open_trace_in_ui).
7*6dbdd20aSAndroid Build Coastguard Worker
8*6dbdd20aSAndroid Build Coastguard WorkerThis can be used as follows:
9*6dbdd20aSAndroid Build Coastguard Worker
10*6dbdd20aSAndroid Build Coastguard Worker```sh
11*6dbdd20aSAndroid Build Coastguard Workercurl -OL https://github.com/google/perfetto/raw/main/tools/open_trace_in_ui
12*6dbdd20aSAndroid Build Coastguard Workerchmod +x open_trace_in_ui
13*6dbdd20aSAndroid Build Coastguard Worker./open_trace_in_ui -i /path/to/trace
14*6dbdd20aSAndroid Build Coastguard Worker```
15*6dbdd20aSAndroid Build Coastguard Worker
16*6dbdd20aSAndroid Build Coastguard WorkerIf you already have a Perfetto checkout, the first two steps can be skipped.
17*6dbdd20aSAndroid Build Coastguard WorkerFrom the Perfetto root, run:
18*6dbdd20aSAndroid Build Coastguard Worker
19*6dbdd20aSAndroid Build Coastguard Worker```sh
20*6dbdd20aSAndroid Build Coastguard Workertools/open_trace_in_ui -i /path/to/trace
21*6dbdd20aSAndroid Build Coastguard Worker```
22*6dbdd20aSAndroid Build Coastguard Worker
23*6dbdd20aSAndroid Build Coastguard Worker## Why does Perfetto not support \<some obscure JSON format feature\>?
24*6dbdd20aSAndroid Build Coastguard Worker
25*6dbdd20aSAndroid Build Coastguard WorkerThe JSON trace format is considered a legacy trace format and is supported on a
26*6dbdd20aSAndroid Build Coastguard Workerbest-effort basis. While we try our best to maintain compatibility with the
27*6dbdd20aSAndroid Build Coastguard Workerchrome://tracing UI and the [format spec](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.nso4gcezn7n1)
28*6dbdd20aSAndroid Build Coastguard Workerin how events are parsed and displayed, this is not always possible.
29*6dbdd20aSAndroid Build Coastguard WorkerThis is especially the case for traces which are programmatically generated
30*6dbdd20aSAndroid Build Coastguard Workeroutside of Chrome and depend on the implementation details of chrome://tracing.
31*6dbdd20aSAndroid Build Coastguard Worker
32*6dbdd20aSAndroid Build Coastguard WorkerIf supporting a feature would introduce a misproportional amount of technical
33*6dbdd20aSAndroid Build Coastguard Workerdebt, we generally make the choice not to support that feature. Users
34*6dbdd20aSAndroid Build Coastguard Workerare recommended to emit [TrackEvent](/docs/instrumentation/track-events.md)
35*6dbdd20aSAndroid Build Coastguard Workerinstead, Perfetto's native trace format. See
36*6dbdd20aSAndroid Build Coastguard Worker[this guide](/docs/reference/synthetic-track-event.md) for how common JSON
37*6dbdd20aSAndroid Build Coastguard Workerevents can be represented using
38*6dbdd20aSAndroid Build Coastguard WorkerTrackEvent.
39*6dbdd20aSAndroid Build Coastguard Worker
40*6dbdd20aSAndroid Build Coastguard Worker## Why are overlapping events in JSON traces not displayed correctly?
41*6dbdd20aSAndroid Build Coastguard Worker
42*6dbdd20aSAndroid Build Coastguard WorkerThe Perfetto UI and trace processor do not support overlapping B/E/X events, in
43*6dbdd20aSAndroid Build Coastguard Workercompliance with the
44*6dbdd20aSAndroid Build Coastguard Worker[JSON spec](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.nso4gcezn7n1).
45*6dbdd20aSAndroid Build Coastguard WorkerAs stated in the spec, events are only allowed to perfecty nest.
46*6dbdd20aSAndroid Build Coastguard Worker
47*6dbdd20aSAndroid Build Coastguard WorkerUsers are recommended to emit
48*6dbdd20aSAndroid Build Coastguard Worker[TrackEvent](/docs/instrumentation/track-events.md)
49*6dbdd20aSAndroid Build Coastguard Workerinstead, Perfetto's native trace format. See
50*6dbdd20aSAndroid Build Coastguard Worker[this guide](/docs/reference/synthetic-track-event.md) for how common JSON
51*6dbdd20aSAndroid Build Coastguard Workerevents can be represented using
52*6dbdd20aSAndroid Build Coastguard WorkerTrackEvent.
53*6dbdd20aSAndroid Build Coastguard Worker
54*6dbdd20aSAndroid Build Coastguard Worker## How can I use Perfetto tooling without instrumenting my program?
55*6dbdd20aSAndroid Build Coastguard Worker
56*6dbdd20aSAndroid Build Coastguard WorkerA common problem is that users want to use Perfetto analysis and visualization
57*6dbdd20aSAndroid Build Coastguard Workertooling but they don't want to instrument their program. This can be because
58*6dbdd20aSAndroid Build Coastguard WorkerPerfetto is not a good fit for their use-case or because they may already have
59*6dbdd20aSAndroid Build Coastguard Workeran existing tracing system.
60*6dbdd20aSAndroid Build Coastguard Worker
61*6dbdd20aSAndroid Build Coastguard WorkerThe recommended approach for this is to emit Perfetto's native TrackEvent proto
62*6dbdd20aSAndroid Build Coastguard Workerformat. A reference guide for this is available
63*6dbdd20aSAndroid Build Coastguard Worker[here](/docs/reference/synthetic-track-event.md).
64*6dbdd20aSAndroid Build Coastguard Worker
65*6dbdd20aSAndroid Build Coastguard Worker
66*6dbdd20aSAndroid Build Coastguard Worker## My app has multiple processes. How can see all of them in the same trace?
67*6dbdd20aSAndroid Build Coastguard Worker
68*6dbdd20aSAndroid Build Coastguard WorkerUse the [Tracing SDK](/docs/instrumentation/tracing-sdk.md#system-mode) in
69*6dbdd20aSAndroid Build Coastguard Worker"system mode". All processes will connect to `traced` over a socket and traced
70*6dbdd20aSAndroid Build Coastguard Workerwill emit one trace with all processes.
71