1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SRC_ANDROID_STATS_PERFETTO_ATOMS_H_
18 #define SRC_ANDROID_STATS_PERFETTO_ATOMS_H_
19 
20 namespace perfetto {
21 
22 // This must match the values of the PerfettoUploadEvent enum in:
23 // frameworks/proto_logging/stats/atoms.proto
24 enum class PerfettoStatsdAtom {
25   kUndefined = 0,
26 
27   // Checkpoints inside perfetto_cmd before tracing is finished.
28   kTraceBegin = 1,
29   kBackgroundTraceBegin = 2,
30   kOnConnect = 3,
31 
32   // Guardrails inside perfetto_cmd before tracing is finished.
33   kOnTimeout = 16,
34   kCmdUserBuildTracingNotAllowed = 43,
35   kCmdFailedToInitGuardrailState = 44,
36   kCmdInvalidGuardrailState = 45,
37   kCmdHitUploadLimit = 46,
38 
39   // Checkpoints inside traced.
40   kTracedEnableTracing = 37,
41   kTracedStartTracing = 38,
42   kTracedDisableTracing = 39,
43   kTracedNotifyTracingDisabled = 40,
44 
45   // Trigger checkpoints inside traced.
46   // These atoms are special because, along with the UUID,
47   // they log the trigger name.
48   kTracedTriggerStartTracing = 41,
49   kTracedTriggerStopTracing = 42,
50 
51   // Guardrails inside traced.
52   kTracedEnableTracingExistingTraceSession = 18,
53   kTracedEnableTracingTooLongTrace = 19,
54   kTracedEnableTracingInvalidTriggerTimeout = 20,
55   kTracedEnableTracingDurationWithTrigger = 21,
56   kTracedEnableTracingStopTracingWriteIntoFile = 22,
57   kTracedEnableTracingDuplicateTriggerName = 23,
58   kTracedEnableTracingInvalidDeferredStart = 24,
59   kTracedEnableTracingInvalidBufferSize = 25,
60   kTracedEnableTracingBufferSizeTooLarge = 26,
61   kTracedEnableTracingTooManyBuffers = 27,
62   kTracedEnableTracingDuplicateSessionName = 28,
63   kTracedEnableTracingSessionNameTooRecent = 29,
64   kTracedEnableTracingTooManySessionsForUid = 30,
65   kTracedEnableTracingTooManyConcurrentSessions = 31,
66   kTracedEnableTracingInvalidFdOutputFile = 32,
67   kTracedEnableTracingFailedToCreateFile = 33,
68   kTracedEnableTracingOom = 34,
69   kTracedEnableTracingUnknown = 35,
70   kTracedStartTracingInvalidSessionState = 36,
71   kTracedEnableTracingInvalidFilter = 47,
72 
73   // Checkpoints inside perfetto_cmd after tracing has finished.
74   kOnTracingDisabled = 4,
75   kUploadIncidentBegin = 8,
76   kFinalizeTraceAndExit = 11,
77   kNotUploadingEmptyTrace = 17,
78 
79   // Guardrails inside perfetto_cmd after tracing has finished.
80   kUploadIncidentFailure = 10,
81 
82   // Deprecated as "success" is misleading; it simply means we were
83   // able to communicate with incidentd. Will be removed once
84   // incidentd is properly instrumented.
85   kUploadIncidentSuccess = 9,
86 
87   // Deprecated as has the potential to be too spammy. Will be
88   // replaced with a whole new atom proto which uses a count metric
89   // instead of the event metric used for this proto.
90   kTriggerBegin = 12,
91   kTriggerSuccess = 13,
92   kTriggerFailure = 14,
93 
94   // Deprecated as too coarse grained to be useful. Will be replaced
95   // with better broken down atoms as we do with traced.
96   kHitGuardrails = 15,
97 
98   // Contained status of Dropbox uploads. Removed as Perfetto no
99   // longer supports uploading traces using Dropbox.
100   // reserved 5, 6, 7;
101 };
102 
103 // This must match the values of the PerfettoTrigger::TriggerType enum in:
104 // frameworks/base/cmds/statsd/src/atoms.proto
105 enum PerfettoTriggerAtom {
106   kUndefined = 0,
107 
108   kCmdTrigger = 1,
109   kCmdTriggerFail = 2,
110 
111   kTriggerPerfettoTrigger = 3,
112   kTriggerPerfettoTriggerFail = 4,
113 
114   kTracedLimitProbability = 5,
115   kTracedLimitMaxPer24h = 6,
116 
117   kProbesProducerTrigger = 7,
118   kProbesProducerTriggerFail = 8,
119 };
120 
121 }  // namespace perfetto
122 
123 #endif  // SRC_ANDROID_STATS_PERFETTO_ATOMS_H_
124