xref: /aosp_15_r20/external/perfetto/docs/design-docs/checkpoint-atoms.md (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Statsd Checkpoint Atoms
2## Tracing
3
4This diagram gives the atoms and the state transitions between when tracing/
5All atoms above log the UUID of the trace;
6`PERFETTO_TRACED_TRIGGER_STOP_TRACING` is special as it *also* logs the trigger
7name which caused trace finalization.
8
9NOTE: dotted lines indicate these transitions only happen in background
10configs; transitions with solid lines happen in both background and
11non-background cases.
12
13NOTE: for background traces, *either* start triggers or stop triggers are
14supported; both cannot happen for the same trace.
15
16```mermaid
17graph TD;
18    PERFETTO_CMD_TRACE_BEGIN-->PERFETTO_CMD_ON_CONNECT;
19    PERFETTO_CMD_BACKGROUND_TRACE_BEGIN-.->PERFETTO_CMD_ON_CONNECT
20    PERFETTO_CMD_ON_CONNECT-->PERFETTO_TRACED_ENABLE_TRACING
21    PERFETTO_TRACED_ENABLE_TRACING-->PERFETTO_TRACED_START_TRACING
22    PERFETTO_TRACED_ENABLE_TRACING-.->|start trigger background traces only|PERFETTO_TRACED_TRIGGER_START_TRACING
23    PERFETTO_TRACED_TRIGGER_START_TRACING-.->PERFETTO_TRACED_START_TRACING
24    PERFETTO_TRACED_START_TRACING-.->|stop trigger background traces only|PERFETTO_TRACED_TRIGGER_STOP_TRACING
25    PERFETTO_TRACED_TRIGGER_STOP_TRACING-.->PERFETTO_TRACED_DISABLE_TRACING
26    PERFETTO_TRACED_START_TRACING-->PERFETTO_TRACED_DISABLE_TRACING
27    PERFETTO_TRACED_DISABLE_TRACING-->PERFETTO_TRACED_NOTIFY_TRACING_DISABLED
28    PERFETTO_TRACED_NOTIFY_TRACING_DISABLED-->PERFETTO_CMD_ON_TRACING_DISABLED
29    PERFETTO_CMD_ON_TRACING_DISABLED-->PERFETTO_CMD_FINALIZE_TRACE_AND_EXIT
30    PERFETTO_CMD_FINALIZE_TRACE_AND_EXIT-->PERFETTO_CMD_UPLOAD_INCIDENT
31    PERFETTO_CMD_FINALIZE_TRACE_AND_EXIT-.->|only if no trigger happened|PERFETTO_CMD_NOT_UPLOADING_EMPTY_TRACE
32```
33
34## Triggers
35
36This diagram gives the atoms which can trigger finalization of a trace.
37These atoms will not be reported individually but instead aggregated by trigger name
38and reported as a count.
39
40```mermaid
41graph TD;
42    PERFETTO_CMD_TRIGGER
43    PERFETTO_TRIGGER_PERFETTO_TRIGGER
44```
45
46