• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// AUTOGENERATED - DO NOT EDIT
2// ---------------------------
3// This file has been generated by
4// AOSP://external/perfetto/tools/gen_merged_protos
5// merging the perfetto config protos.
6// This fused proto is intended to be copied in:
7//  - Android tree, for statsd.
8//  - Google internal repos.
9
10syntax = "proto2";
11
12package perfetto.protos;
13
14option go_package = "github.com/google/perfetto/perfetto_proto";
15
16// Begin of protos/perfetto/common/ftrace_descriptor.proto
17
18message FtraceDescriptor {
19  message AtraceCategory {
20    optional string name = 1;
21    optional string description = 2;
22  }
23
24  // Report the available atrace categories.
25  //
26  // Used by Traceur via `perfetto --query`.
27  repeated AtraceCategory atrace_categories = 1;
28}
29
30// End of protos/perfetto/common/ftrace_descriptor.proto
31
32// Begin of protos/perfetto/common/gpu_counter_descriptor.proto
33
34// Description of GPU counters.
35// This message is sent by a GPU counter producer to specify the counters
36// available in the hardware.
37message GpuCounterDescriptor {
38  // Logical groups for a counter.  This is used in the UI to present the
39  // related counters together.
40  enum GpuCounterGroup {
41    UNCLASSIFIED = 0;
42    SYSTEM = 1;
43    VERTICES = 2;
44    FRAGMENTS = 3;
45    PRIMITIVES = 4;
46    // Includes counters relating to caching and bandwidth.
47    MEMORY = 5;
48    COMPUTE = 6;
49  }
50
51  message GpuCounterSpec {
52    optional uint32 counter_id = 1;
53    optional string name = 2;
54    optional string description = 3;
55    // MeasureUnit unit (deprecated)
56    reserved 4;
57    oneof peak_value {
58      int64 int_peak_value = 5;
59      double double_peak_value = 6;
60    }
61    repeated MeasureUnit numerator_units = 7;
62    repeated MeasureUnit denominator_units = 8;
63    optional bool select_by_default = 9;
64    repeated GpuCounterGroup groups = 10;
65  }
66  repeated GpuCounterSpec specs = 1;
67
68  // Allow producer to group counters into block to represent counter islands.
69  // A capacity may be specified to indicate the number of counters that can be
70  // enable simultaneously in that block.
71  message GpuCounterBlock {
72    // required. Unique ID for the counter group.
73    optional uint32 block_id = 1;
74    // optional. Number of counters supported by the block. No limit if unset.
75    optional uint32 block_capacity = 2;
76    // optional. Name of block.
77    optional string name = 3;
78    // optional. Description for the block.
79    optional string description = 4;
80    // list of counters that are part of the block.
81    repeated uint32 counter_ids = 5;
82  }
83  repeated GpuCounterBlock blocks = 2;
84
85  // optional.  Minimum sampling period supported by the producer in
86  // nanoseconds.
87  optional uint64 min_sampling_period_ns = 3;
88
89  // optional.  Maximum sampling period supported by the producer in
90  // nanoseconds.
91  optional uint64 max_sampling_period_ns = 4;
92
93  // optional.  The producer supports counter sampling by instrumenting the
94  // command buffer.
95  optional bool supports_instrumented_sampling = 5;
96
97  // next id: 41
98  enum MeasureUnit {
99    NONE = 0;
100
101    BIT = 1;
102    KILOBIT = 2;
103    MEGABIT = 3;
104    GIGABIT = 4;
105    TERABIT = 5;
106    PETABIT = 6;
107
108    BYTE = 7;
109    KILOBYTE = 8;
110    MEGABYTE = 9;
111    GIGABYTE = 10;
112    TERABYTE = 11;
113    PETABYTE = 12;
114
115    HERTZ = 13;
116    KILOHERTZ = 14;
117    MEGAHERTZ = 15;
118    GIGAHERTZ = 16;
119    TERAHERTZ = 17;
120    PETAHERTZ = 18;
121
122    NANOSECOND = 19;
123    MICROSECOND = 20;
124    MILLISECOND = 21;
125    SECOND = 22;
126    MINUTE = 23;
127    HOUR = 24;
128
129    VERTEX = 25;
130    PIXEL = 26;
131    TRIANGLE = 27;
132    PRIMITIVE = 38;
133    FRAGMENT = 39;
134
135    MILLIWATT = 28;
136    WATT = 29;
137    KILOWATT = 30;
138
139    JOULE = 31;
140    VOLT = 32;
141    AMPERE = 33;
142
143    CELSIUS = 34;
144    FAHRENHEIT = 35;
145    KELVIN = 36;
146
147    // Values should be out of 100.
148    PERCENT = 37;
149
150    INSTRUCTION = 40;
151  }
152}
153
154// End of protos/perfetto/common/gpu_counter_descriptor.proto
155
156// Begin of protos/perfetto/common/track_event_descriptor.proto
157
158message TrackEventCategory {
159  optional string name = 1;
160  optional string description = 2;
161  repeated string tags = 3;
162}
163
164message TrackEventDescriptor {
165  repeated TrackEventCategory available_categories = 1;
166}
167
168// End of protos/perfetto/common/track_event_descriptor.proto
169
170// Begin of protos/perfetto/common/data_source_descriptor.proto
171
172// This message is sent from Producer(s) to the tracing Service when registering
173// to advertise their capabilities. It describes the structure of tracing
174// protos that will be produced by the data source and the supported filters.
175message DataSourceDescriptor {
176  // e.g., "linux.ftrace", "chromium.tracing"
177  optional string name = 1;
178
179  // When non-zero, this is a unique ID within the scope of the Producer for
180  // this data source (it is NOT globally unique). This is useful to
181  // differentiate between data sources with matching names when calling
182  // UpdateDataSource(). This field has been introduced in November 2021
183  // (v22, Android T) and is not supported on older versions.
184  optional uint64 id = 7;
185
186  // When true the data source is expected to ack the stop request through the
187  // NotifyDataSourceStopped() IPC. This field has been introduced after
188  // Android P in Jul 2018 and is not supported on older versions.
189  optional bool will_notify_on_stop = 2;
190
191  // When true the data source is expected to ack the start request through the
192  // NotifyDataSourceStarted() IPC. This field has been introduced after
193  // Android P in March 2019 and is not supported on older versions.
194  optional bool will_notify_on_start = 3;
195
196  // If true, opt into receiving the ClearIncrementalState() IPC. This should be
197  // set if the data source writes packets that refer to previous trace
198  // contents, and knows how to stop referring to the already-emitted data.
199  optional bool handles_incremental_state_clear = 4;
200
201  // Optional specification about available GPU counters.
202  optional GpuCounterDescriptor gpu_counter_descriptor = 5 [lazy = true];
203
204  optional TrackEventDescriptor track_event_descriptor = 6 [lazy = true];
205
206  optional FtraceDescriptor ftrace_descriptor = 8 [lazy = true];
207}
208
209// End of protos/perfetto/common/data_source_descriptor.proto
210
211// Begin of protos/perfetto/common/tracing_service_state.proto
212
213// Reports the state of the tracing service. Used to gather details about the
214// data sources connected.
215// See ConsumerPort::QueryServiceState().
216message TracingServiceState {
217  // Describes a producer process.
218  message Producer {
219    // Unique ID of the producer (monotonic counter).
220    optional int32 id = 1;
221
222    // Typically matches the process name.
223    optional string name = 2;
224
225    // Unix pid of the remote process. Supported only on Linux-based systems.
226    // Introduced in v24 / Android T.
227    optional int32 pid = 5;
228
229    // Unix uid of the remote process.
230    optional int32 uid = 3;
231
232    // The version of the client library used by the producer.
233    // This is a human readable string with and its format varies depending on
234    // the build system and the repo (standalone vs AOSP).
235    // This is intended for human debugging only.
236    optional string sdk_version = 4;
237  }
238
239  // Describes a data source registered by a producer. Data sources are listed
240  // regardless of the fact that they are being used or not.
241  message DataSource {
242    // Descriptor passed by the data source when calling RegisterDataSource().
243    optional DataSourceDescriptor ds_descriptor = 1;
244
245    // ID of the producer, as per Producer.id.
246    optional int32 producer_id = 2;
247  }
248
249  message TracingSession {
250    // The TracingSessionID.
251    optional uint64 id = 1;
252
253    // The Unix uid of the consumer that started the session.
254    // This is meaningful only if the caller is root. In all other cases only
255    // tracing sessions that match the caller UID will be displayed.
256    optional int32 consumer_uid = 2;
257
258    // Internal state of the tracing session.
259    // These strings are FYI only and subjected to change.
260    optional string state = 3;
261
262    // The unique_session_name as set in the trace config (might be empty).
263    optional string unique_session_name = 4;
264
265    // The number and size of each buffer.
266    repeated uint32 buffer_size_kb = 5;
267
268    // Duration, as specified in the TraceConfig.duration_ms.
269    optional uint32 duration_ms = 6;
270
271    // Number of data sources involved in the session.
272    optional uint32 num_data_sources = 7;
273
274    // Time when the session was started, in the CLOCK_REALTIME domain.
275    // Available only on Linux-based systems.
276    optional int64 start_realtime_ns = 8;
277  }
278
279  // Lists all the producers connected.
280  repeated Producer producers = 1;
281
282  // Lists the data sources available.
283  repeated DataSource data_sources = 2;
284
285  // Lists the tracing sessions active AND owned by a consumer that has the same
286  // UID of the caller (or all of them if the caller is root).
287  // Introduced in v24 / Android T.
288  repeated TracingSession tracing_sessions = 6;
289
290  // This is always set to true from v24 and beyond. This flag is only used to
291  // tell the difference between: (1) talking to a recent service which happens
292  // to have no tracing session active; (2) talking to an older version of the
293  // service which will never report any tracing session.
294  optional bool supports_tracing_sessions = 7;
295
296  // Total number of tracing sessions.
297  optional int32 num_sessions = 3;
298
299  // Number of tracing sessions in the started state. Always <= num_sessions.
300  optional int32 num_sessions_started = 4;
301
302  // The version of traced (the same returned by `traced --version`).
303  // This is a human readable string with and its format varies depending on
304  // the build system and the repo (standalone vs AOSP).
305  // This is intended for human debugging only.
306  optional string tracing_service_version = 5;
307}
308
309// End of protos/perfetto/common/tracing_service_state.proto
310
311// Begin of protos/perfetto/common/builtin_clock.proto
312
313enum BuiltinClock {
314  BUILTIN_CLOCK_UNKNOWN = 0;
315  BUILTIN_CLOCK_REALTIME = 1;
316  BUILTIN_CLOCK_REALTIME_COARSE = 2;
317  BUILTIN_CLOCK_MONOTONIC = 3;
318  BUILTIN_CLOCK_MONOTONIC_COARSE = 4;
319  BUILTIN_CLOCK_MONOTONIC_RAW = 5;
320  BUILTIN_CLOCK_BOOTTIME = 6;
321  BUILTIN_CLOCK_MAX_ID = 63;
322
323  reserved 7, 8;
324
325  // An internal CL (ag/16521245) has taken this for BUILTIN_CLOCK_TSC.
326  // That might get upstreamed later on. Avoid diverging on this ID in future.
327  reserved 9;
328}
329
330// End of protos/perfetto/common/builtin_clock.proto
331
332// Begin of protos/perfetto/config/android/android_game_intervention_list_config.proto
333
334// Data source that lists game modes and game interventions of games
335// on an Android device.
336message AndroidGameInterventionListConfig {
337  // If not empty, emit info about only the following list of package names
338  // (exact match, no regex). Otherwise, emit info about all packages.
339  repeated string package_name_filter = 1;
340}
341
342// End of protos/perfetto/config/android/android_game_intervention_list_config.proto
343
344// Begin of protos/perfetto/common/android_log_constants.proto
345
346// Values from NDK's android/log.h.
347enum AndroidLogId {
348  // MAIN.
349  LID_DEFAULT = 0;
350
351  LID_RADIO = 1;
352  LID_EVENTS = 2;
353  LID_SYSTEM = 3;
354  LID_CRASH = 4;
355  LID_STATS = 5;
356  LID_SECURITY = 6;
357  LID_KERNEL = 7;
358}
359
360enum AndroidLogPriority {
361  PRIO_UNSPECIFIED = 0;
362
363  // _DEFAULT, but should never be seen in logs.
364  PRIO_UNUSED = 1;
365
366  PRIO_VERBOSE = 2;
367  PRIO_DEBUG = 3;
368  PRIO_INFO = 4;
369  PRIO_WARN = 5;
370  PRIO_ERROR = 6;
371  PRIO_FATAL = 7;
372}
373
374// End of protos/perfetto/common/android_log_constants.proto
375
376// Begin of protos/perfetto/config/android/android_log_config.proto
377
378message AndroidLogConfig {
379  repeated AndroidLogId log_ids = 1;
380
381  // Was |poll_ms|, deprecated.
382  reserved 2;
383
384  // If set ignores all log messages whose prio is < the given value.
385  optional AndroidLogPriority min_prio = 3;
386
387  // If non-empty ignores all log messages whose tag doesn't match one of the
388  // specified values.
389  repeated string filter_tags = 4;
390}
391
392// End of protos/perfetto/config/android/android_log_config.proto
393
394// Begin of protos/perfetto/config/android/android_polled_state_config.proto
395
396// Data source that polls for display state. This should only be used for
397// backward-compatibility; AndroidSystemPropertyConfig should be preferred.
398message AndroidPolledStateConfig {
399  // Frequency of polling. If absent the state will be recorded once, at the
400  // start of the trace.
401  // This is required to be > 100ms to avoid excessive CPU usage.
402  optional uint32 poll_ms = 1;
403}
404
405// End of protos/perfetto/config/android/android_polled_state_config.proto
406
407// Begin of protos/perfetto/config/android/android_system_property_config.proto
408
409// Data source that polls for system properties.
410message AndroidSystemPropertyConfig {
411  // Frequency of polling. If absent the state will be recorded once, at the
412  // start of the trace.
413  // This is required to be > 100ms to avoid excessive CPU usage.
414  optional uint32 poll_ms = 1;
415
416  // Properties to poll. All property names must start with "debug.tracing.".
417  repeated string property_name = 2;
418}
419
420// End of protos/perfetto/config/android/android_system_property_config.proto
421
422// Begin of protos/perfetto/config/android/network_trace_config.proto
423
424// Network tracing data source that records details on all packets sent or
425// received by the network.
426message NetworkPacketTraceConfig {
427  // Polling frequency in milliseconds. Network tracing writes to a fixed size
428  // ring buffer. The polling interval should be such that the ring buffer is
429  // unlikely to fill in that interval (or that filling is an acceptable risk).
430  // The minimum polling rate is 100ms (values below this are ignored).
431  // Introduced in Android 14 (U).
432  optional uint32 poll_ms = 1;
433
434  // The aggregation_threshold is the number of packets at which an event will
435  // switch from per-packet details to aggregate details. For example, a value
436  // of 50 means that if a particular event (grouped by the unique combinations
437  // of metadata fields: {interface, direction, uid, etc}) has fewer than 50
438  // packets, the exact timestamp and length are recorded for each packet. If
439  // there were 50 or more packets in an event, it would only record the total
440  // duration, packets, and length. A value of zero or unspecified will always
441  /// record per-packet details. A value of 1 always records aggregate details.
442  optional uint32 aggregation_threshold = 2;
443
444  // Specifies the maximum number of packet contexts to intern at a time. This
445  // prevents the interning table from growing too large and controls whether
446  // interning is enabled or disabled (a value of zero disables interning and
447  // is the default). When a data sources interning table reaches this amount,
448  // packet contexts will be inlined into NetworkPacketEvents.
449  optional uint32 intern_limit = 3;
450
451  // The following fields specify whether certain fields should be dropped from
452  // the output. Dropping fields improves normalization results, reduces the
453  // size of the interning table, and slightly reduces event size.
454  optional bool drop_local_port = 4;
455  optional bool drop_remote_port = 5;
456  optional bool drop_tcp_flags = 6;
457}
458
459// End of protos/perfetto/config/android/network_trace_config.proto
460
461// Begin of protos/perfetto/config/android/packages_list_config.proto
462
463// Data source that lists details (such as version code) about packages on an
464// Android device.
465message PackagesListConfig {
466  // If not empty, emit info about only the following list of package names
467  // (exact match, no regex). Otherwise, emit info about all packages.
468  repeated string package_name_filter = 1;
469}
470
471// End of protos/perfetto/config/android/packages_list_config.proto
472
473// Begin of protos/perfetto/config/chrome/chrome_config.proto
474
475message ChromeConfig {
476  optional string trace_config = 1;
477
478  // When enabled, the data source should only fill in fields in the output that
479  // are not potentially privacy sensitive.
480  optional bool privacy_filtering_enabled = 2;
481
482  // Instead of emitting binary protobuf, convert the trace data to the legacy
483  // JSON format. Note that the trace data will still be returned as a series of
484  // TracePackets, but the embedded data will be JSON instead of serialized
485  // protobuf.
486  optional bool convert_to_legacy_json = 3;
487
488  // Priority of the tracing session client. A higher priority session may
489  // preempt a lower priority one in configurations where concurrent sessions
490  // aren't supported.
491  enum ClientPriority {
492    UNKNOWN = 0;
493    BACKGROUND = 1;
494    USER_INITIATED = 2;
495  }
496  optional ClientPriority client_priority = 4;
497
498  // Applicable only when using legacy JSON format.
499  // If |json_agent_label_filter| is not empty, only data pertaining to
500  // the specified tracing agent label (e.g. "traceEvents") will be returned.
501  optional string json_agent_label_filter = 5;
502}
503
504// End of protos/perfetto/config/chrome/chrome_config.proto
505
506// Begin of protos/perfetto/config/ftrace/ftrace_config.proto
507
508// Next id: 26.
509message FtraceConfig {
510  repeated string ftrace_events = 1;
511  repeated string atrace_categories = 2;
512  repeated string atrace_apps = 3;
513  // *Per-CPU* buffer size.
514  optional uint32 buffer_size_kb = 10;
515  optional uint32 drain_period_ms = 11;
516
517  // Configuration for compact encoding of scheduler events. When enabled (and
518  // recording the relevant ftrace events), specific high-volume events are
519  // encoded in a denser format than normal.
520  message CompactSchedConfig {
521    // If true, and sched_switch or sched_waking ftrace events are enabled,
522    // record those events in the compact format.
523    optional bool enabled = 1;
524  }
525  optional CompactSchedConfig compact_sched = 12;
526
527  // Optional filter for "ftrace/print" events.
528  //
529  // The filter consists of multiple rules. As soon as a rule matches (the rules
530  // are processed in order), its `allow` field will be used as the outcome: if
531  // `allow` is true, the event will be included in the trace, otherwise it will
532  // be discarded. If an event does not match any rule, it will be allowed by
533  // default (a rule with an empty prefix and allow=false, disallows everything
534  // by default).
535  message PrintFilter {
536    message Rule {
537      // Matches an atrace message of the form:
538      // <type>|pid|<prefix>...
539      message AtraceMessage {
540        optional string type = 1;
541        optional string prefix = 2;
542      }
543      oneof match {
544        // This rule matches if `prefix` matches exactly with the beginning of
545        // the "ftrace/print" "buf" field.
546        string prefix = 1;
547        // This rule matches if the "buf" field contains an atrace-style print
548        // message as specified in `atrace_msg`.
549        AtraceMessage atrace_msg = 3;
550      }
551      optional bool allow = 2;
552    }
553    repeated Rule rules = 1;
554  }
555  optional PrintFilter print_filter = 22;
556
557  // Enables symbol name resolution against /proc/kallsyms.
558  // It requires that either traced_probes is running as root or that
559  // kptr_restrict has been manually lowered.
560  // It does not disclose KASLR, symbol addresses are mangled.
561  optional bool symbolize_ksyms = 13;
562
563  // When symbolize_ksyms=true, determines whether the traced_probes daemon
564  // should keep the symbol map in memory (and reuse it for future tracing
565  // sessions) or clear it (saving memory) and re-create it on each tracing
566  // session (wasting cpu and wall time).
567  // The tradeoff is roughly:
568  //  KSYMS_RETAIN: pay a fixed ~1.2 MB cost after the first trace.
569  //  KSYMS_CLEANUP_ON_STOP: pay a ~300-500ms cost when starting each trace.
570  // Default behavior: KSYMS_CLEANUP_ON_STOP.
571  enum KsymsMemPolicy {
572    KSYMS_UNSPECIFIED = 0;
573    KSYMS_CLEANUP_ON_STOP = 1;
574    KSYMS_RETAIN = 2;
575  }
576  optional KsymsMemPolicy ksyms_mem_policy = 17;
577
578  // By default the kernel symbolizer is lazily initialized on a deferred task
579  // to reduce ftrace's time-to-start-recording. Unfortunately that makes
580  // ksyms integration tests hard. This flag forces the kernel symbolizer to be
581  // initialized synchronously on the data source start and hence avoiding
582  // timing races in tests.
583  // DEPRECATED in v28 / Android U. This is now the default behavior, setting it
584  // to true is a no-op.
585  optional bool initialize_ksyms_synchronously_for_testing = 14
586      [deprecated = true];
587
588  // When this boolean is true AND the ftrace_events contains "kmem/rss_stat",
589  // this option causes traced_probes to enable the "kmem/rss_stat_throttled"
590  // event instead if present, and fall back to "kmem/rss_stat" if not present.
591  // The historical context for this is the following:
592  // - Up to Android S (12), the rss_stat was internally throttled in its
593  //   kernel implementation.
594  // - A change introduced in the kernels after S has introduced a new
595  //   "rss_stat_throttled" making the original "rss_stat" event unthrottled
596  //   (hence very spammy).
597  // - Not all Android T/13 devices will receive a new kernel though, hence we
598  //   need to deal with both cases.
599  // For more context: go/rss-stat-throttled.
600  optional bool throttle_rss_stat = 15;
601
602  // If true, avoid enabling events that aren't statically known by
603  // traced_probes. Otherwise, the default is to emit such events as
604  // GenericFtraceEvent protos.
605  // Prefer to keep this flag at its default. This was added for Android
606  // tracing, where atrace categories and/or atrace HAL requested events can
607  // expand to events that aren't of interest to the tracing user.
608  // Introduced in: Android T.
609  optional bool disable_generic_events = 16;
610
611  // The list of syscalls that should be recorded by sys_{enter,exit} ftrace
612  // events. When empty, all syscalls are recorded. If neither sys_{enter,exit}
613  // are enabled, this setting has no effect. Example: ["sys_read", "sys_open"].
614  // Introduced in: Android U.
615  repeated string syscall_events = 18;
616
617  // If true, enable the "function_graph" kernel tracer that emits events
618  // whenever a kernel function is entered and exited
619  // (funcgraph_entry/funcgraph_exit).
620  // Notes on use:
621  // * Requires |symbolize_ksyms| for function name resolution.
622  // * Use |function_filters| or |function_graph_roots| to constrain the traced
623  //   set of functions, otherwise the event bandwidth will be too high for
624  //   practical use.
625  // * The data source might be rejected if there is already a concurrent
626  //   ftrace data source that does not use function graph itself, as we do not
627  //   support switching kernel tracers mid-trace.
628  // * Requires a kernel compiled with CONFIG_FUNCTION_GRAPH_TRACER. This is
629  //   enabled if "cat /sys/kernel/tracing/available_tracers" includes
630  //   "function_graph".
631  // Android:
632  // * Available only on debuggable builds.
633  // * Introduced in: Android U.
634  optional bool enable_function_graph = 19;
635
636  // Constrains the set of functions traced when |enable_function_graph| is
637  // true. Supports globs, e.g. "sched*". You can specify multiple filters,
638  // in which case all matching functions will be traced. See kernel
639  // documentation on ftrace "set_ftrace_filter" file for more details.
640  // Android:
641  // * Available only on debuggable builds.
642  // * Introduced in: Android U.
643  repeated string function_filters = 20;
644
645  // If |enable_function_graph| is true, trace this set of functions *and* all
646  // of its callees. Supports globs. Can be set together with
647  // |function_filters|, in which case only callees matching the filter will be
648  // traced. If setting both, you most likely want all roots to also be
649  // included in |function_filters|.
650  // Android:
651  // * Available only on debuggable builds.
652  // * Introduced in: Android U.
653  repeated string function_graph_roots = 21;
654
655  // If true, does not clear ftrace buffers before the start of the program.
656  // This makes sense only if this is the first ftrace data source instance
657  // created after the daemon has been started. Can be useful for gathering boot
658  // traces, if ftrace has been separately configured (e.g. via kernel
659  // commandline).
660  optional bool preserve_ftrace_buffer = 23;
661
662  // If true, overrides the default timestamp clock and uses a raw hardware
663  // based monotonic clock for getting timestamps.
664  // * Introduced in: Android U.
665  optional bool use_monotonic_raw_clock = 24;
666
667  // Caution: under development as of 2023/03/01.
668  // If |instance_name| is not empty, then attempt to use that tracefs instance
669  // for event recording. Normally, this means
670  // `/sys/kernel/tracing/instances/$instance_name`.
671  //
672  // The name "hyp" is reserved.
673  //
674  // The instance must already exist, the tracing daemon *will not* create it
675  // for you as it typically doesn't have such permissions.
676  // Only a subset of features is guaranteed to work with non-default instances,
677  // at the time of writing:
678  //  * ftrace_events
679  //  * buffer_size_kb
680  // TODO(b/249050813): reword comment once instance support is stable.
681  optional string instance_name = 25;
682}
683
684// End of protos/perfetto/config/ftrace/ftrace_config.proto
685
686// Begin of protos/perfetto/config/gpu/gpu_counter_config.proto
687
688message GpuCounterConfig {
689  // Desired sampling interval for counters.
690  optional uint64 counter_period_ns = 1;
691
692  // List of counters to be sampled. Counter IDs correspond to the ones
693  // described in GpuCounterSpec in the data source descriptor.
694  repeated uint32 counter_ids = 2;
695
696  // Sample counters by instrumenting command buffers.
697  optional bool instrumented_sampling = 3;
698
699  // Fix gpu clock rate during trace session.
700  optional bool fix_gpu_clock = 4;
701}
702
703// End of protos/perfetto/config/gpu/gpu_counter_config.proto
704
705// Begin of protos/perfetto/config/gpu/vulkan_memory_config.proto
706
707message VulkanMemoryConfig {
708  // Tracking driver memory usage events
709  optional bool track_driver_memory_usage = 1;
710
711  // Tracking device memory usage events
712  optional bool track_device_memory_usage = 2;
713}
714
715// End of protos/perfetto/config/gpu/vulkan_memory_config.proto
716
717// Begin of protos/perfetto/config/inode_file/inode_file_config.proto
718
719message InodeFileConfig {
720  message MountPointMappingEntry {
721    optional string mountpoint = 1;
722    repeated string scan_roots = 2;
723  }
724
725  // How long to pause between batches.
726  optional uint32 scan_interval_ms = 1;
727
728  // How long to wait before the first scan in order to accumulate inodes.
729  optional uint32 scan_delay_ms = 2;
730
731  // How many inodes to scan in one batch.
732  optional uint32 scan_batch_size = 3;
733
734  // Do not scan for inodes not found in the static map.
735  optional bool do_not_scan = 4;
736
737  // If non-empty, only scan inodes corresponding to block devices named in
738  // this list.
739  repeated string scan_mount_points = 5;
740
741  // When encountering an inode belonging to a block device corresponding
742  // to one of the mount points in this map, scan its scan_roots instead.
743  repeated MountPointMappingEntry mount_point_mapping = 6;
744}
745
746// End of protos/perfetto/config/inode_file/inode_file_config.proto
747
748// Begin of protos/perfetto/config/interceptors/console_config.proto
749
750message ConsoleConfig {
751  enum Output {
752    OUTPUT_UNSPECIFIED = 0;
753    OUTPUT_STDOUT = 1;
754    OUTPUT_STDERR = 2;
755  }
756  optional Output output = 1;
757  optional bool enable_colors = 2;
758}
759
760// End of protos/perfetto/config/interceptors/console_config.proto
761
762// Begin of protos/perfetto/config/interceptor_config.proto
763
764// Configuration for trace packet interception. Used for diverting trace data to
765// non-Perfetto sources (e.g., logging to the console, ETW) when using the
766// Perfetto SDK.
767message InterceptorConfig {
768  // Matches the name given to RegisterInterceptor().
769  optional string name = 1;
770
771  optional ConsoleConfig console_config = 100 [lazy = true];
772}
773
774// End of protos/perfetto/config/interceptor_config.proto
775
776// Begin of protos/perfetto/config/power/android_power_config.proto
777
778message AndroidPowerConfig {
779  enum BatteryCounters {
780    BATTERY_COUNTER_UNSPECIFIED = 0;
781
782    // Coulomb counter.
783    BATTERY_COUNTER_CHARGE = 1;
784
785    // Charge (%).
786    BATTERY_COUNTER_CAPACITY_PERCENT = 2;
787
788    // Instantaneous current.
789    BATTERY_COUNTER_CURRENT = 3;
790
791    // Avg current.
792    BATTERY_COUNTER_CURRENT_AVG = 4;
793  }
794  optional uint32 battery_poll_ms = 1;
795  repeated BatteryCounters battery_counters = 2;
796
797  // Where available enables per-power-rail measurements.
798  optional bool collect_power_rails = 3;
799
800  // Provides a breakdown of energy estimation for various subsystem (e.g. GPU).
801  // Available from Android S.
802  optional bool collect_energy_estimation_breakdown = 4;
803
804  // Provides a breakdown of time in state for various subsystems.
805  // Available from Android U.
806  optional bool collect_entity_state_residency = 5;
807}
808
809// End of protos/perfetto/config/power/android_power_config.proto
810
811// Begin of protos/perfetto/config/process_stats/process_stats_config.proto
812
813message ProcessStatsConfig {
814  enum Quirks {
815    QUIRKS_UNSPECIFIED = 0;
816
817    // This has been deprecated and ignored as per 2018-05-01. Full scan at
818    // startup is now disabled by default and can be re-enabled using the
819    // |scan_all_processes_on_start| arg.
820    DISABLE_INITIAL_DUMP = 1 [deprecated = true];
821
822    DISABLE_ON_DEMAND = 2;
823  }
824
825  repeated Quirks quirks = 1;
826
827  // If enabled all processes will be scanned and dumped when the trace starts.
828  optional bool scan_all_processes_on_start = 2;
829
830  // If enabled thread names are also recoded (this is redundant if sched_switch
831  // is enabled).
832  optional bool record_thread_names = 3;
833
834  // If > 0 samples counters (see process_stats.proto) from
835  // /proc/pid/status and oom_score_adj every X ms.
836  // It will also sample /proc/pid/smaps_rollup if scan_smaps_rollup = true.
837  // This is required to be > 100ms to avoid excessive CPU usage.
838  // TODO(primiano): add CPU cost for change this value.
839  optional uint32 proc_stats_poll_ms = 4;
840
841  // If empty samples stats for all processes. If non empty samples stats only
842  // for processes matching the given string in their argv0 (i.e. the first
843  // entry of /proc/pid/cmdline).
844  // TODO(primiano): implement this feature.
845  // repeated string proc_stats_filter = 5;
846
847  // This is required to be either = 0 or a multiple of |proc_stats_poll_ms|
848  // (default: |proc_stats_poll_ms|). If = 0, will be set to
849  // |proc_stats_poll_ms|. Non-multiples will be rounded down to the nearest
850  // multiple.
851  optional uint32 proc_stats_cache_ttl_ms = 6;
852
853  // DEPRECATED record_thread_time_in_state
854  reserved 7;
855
856  // DEPRECATED thread_time_in_state_cache_size
857  reserved 8;
858
859  // If true this will resolve filedescriptors for each process so these
860  // can be mapped to their actual device or file.
861  // Requires raw_syscalls/sys_exit ftrace events to be enabled or
862  // new fds opened after initially scanning a process will not be
863  // recognized.
864  optional bool resolve_process_fds = 9;
865
866  // If enabled memory stats from /proc/pid/smaps_rollup will be included
867  // in process stats.
868  optional bool scan_smaps_rollup = 10;
869}
870
871// End of protos/perfetto/config/process_stats/process_stats_config.proto
872
873// Begin of protos/perfetto/config/profiling/heapprofd_config.proto
874
875// Configuration for go/heapprofd.
876// Next id: 28
877message HeapprofdConfig {
878  message ContinuousDumpConfig {
879    // ms to wait before first dump.
880    optional uint32 dump_phase_ms = 5;
881    // ms to wait between following dumps.
882    optional uint32 dump_interval_ms = 6;
883  }
884
885  // Sampling rate for all heaps not specified via heap_sampling_intervals.
886  //
887  // These are:
888  // * All heaps if heap_sampling_intervals is empty.
889  // * Those profiled due to all_heaps and not named in heaps if
890  //   heap_sampling_intervals is not empty.
891  // * The implicit libc.malloc heap if heaps is empty.
892  //
893  // Set to 1 for perfect accuracy.
894  // Otherwise, sample every sample_interval_bytes on average.
895  //
896  // See
897  // https://perfetto.dev/docs/data-sources/native-heap-profiler#sampling-interval
898  // for more details.
899  //
900  // BUGS
901  // Before Android 12, setting this to 0 would crash the target process.
902  //
903  // N.B. This must be explicitly set to a non-zero value for all heaps (with
904  // this field or with heap_sampling_intervals), otherwise the producer will
905  // not start.
906  optional uint64 sampling_interval_bytes = 1;
907
908  // If less than the given numbers of bytes are left free in the shared
909  // memory buffer, increase sampling interval by a factor of two.
910  // Adaptive sampling is disabled when set to 0.
911  optional uint64 adaptive_sampling_shmem_threshold = 24;
912  // Stop doubling the sampling_interval once the sampling interval has reached
913  // this value.
914  optional uint64 adaptive_sampling_max_sampling_interval_bytes = 25;
915
916  // E.g. surfaceflinger, com.android.phone
917  // This input is normalized in the following way: if it contains slashes,
918  // everything up to the last slash is discarded. If it contains "@",
919  // everything after the first @ is discared.
920  // E.g. /system/bin/surfaceflinger@1.0 normalizes to surfaceflinger.
921  // This transformation is also applied to the processes' command lines when
922  // matching.
923  repeated string process_cmdline = 2;
924
925  // For watermark based triggering or local debugging.
926  repeated uint64 pid = 4;
927
928  // Only profile target if it was installed by one of the packages given.
929  // Special values are:
930  // * @system: installed on the system partition
931  // * @product: installed on the product partition
932  // * @null: sideloaded
933  // Supported on Android 12+.
934  repeated string target_installed_by = 26;
935
936  // Which heaps to sample, e.g. "libc.malloc". If left empty, only samples
937  // "malloc".
938  //
939  // Introduced in Android 12.
940  repeated string heaps = 20;
941
942  // Which heaps not to sample, e.g. "libc.malloc". This is useful when used in
943  // combination with all_heaps;
944  //
945  // Introduced in Android 12.
946  repeated string exclude_heaps = 27;
947
948  optional bool stream_allocations = 23;
949
950  // If given, needs to be the same length as heaps and gives the sampling
951  // interval for the respective entry in heaps.
952  //
953  // Otherwise, sampling_interval_bytes is used.
954  //
955  // It is recommended to set sampling_interval_bytes to a reasonable default
956  // value when using this, as a value of 0 for sampling_interval_bytes will
957  // crash the target process before Android 12.
958  //
959  // Introduced in Android 12.
960  //
961  // All values must be non-zero or the producer will not start.
962  repeated uint64 heap_sampling_intervals = 22;
963
964  // Sample all heaps registered by target process. Introduced in Android 12.
965  optional bool all_heaps = 21;
966
967  // Profile all processes eligible for profiling on the system.
968  // See
969  // https://perfetto.dev/docs/data-sources/native-heap-profiler#heapprofd-targets
970  // for which processes are eligible.
971  //
972  // On unmodified userdebug builds, this will lead to system crashes. Zygote
973  // will crash when trying to launch a new process as it will have an
974  // unexpected open socket to heapprofd.
975  //
976  // heapprofd will likely be overloaded by the amount of data for low
977  // sampling intervals.
978  optional bool all = 5;
979
980  // Do not profile processes whose anon RSS + swap < given value.
981  // Introduced in Android 11.
982  optional uint32 min_anonymous_memory_kb = 15;
983
984  // Stop profile if heapprofd memory usage goes beyond the given value.
985  // Introduced in Android 11.
986  optional uint32 max_heapprofd_memory_kb = 16;
987
988  // Stop profile if heapprofd CPU time since start of this data-source
989  // goes beyond given value.
990  // Introduced in Android 11.
991  optional uint64 max_heapprofd_cpu_secs = 17;
992
993  // Do not emit function names for mappings starting with this prefix.
994  // E.g. /system to not emit symbols for any system libraries.
995  repeated string skip_symbol_prefix = 7;
996
997  // Dump at a predefined interval.
998  optional ContinuousDumpConfig continuous_dump_config = 6;
999
1000  // Size of the shared memory buffer between the profiled processes and
1001  // heapprofd. Defaults to 8 MiB. If larger than 500 MiB, truncated to 500
1002  // MiB.
1003  //
1004  // Needs to be:
1005  // * at least 8192,
1006  // * a power of two,
1007  // * a multiple of 4096.
1008  optional uint64 shmem_size_bytes = 8;
1009
1010  // When the shmem buffer is full, block the client instead of ending the
1011  // trace. Use with caution as this will significantly slow down the target
1012  // process.
1013  optional bool block_client = 9;
1014
1015  // If set, stop the trace session after blocking the client for this
1016  // timeout. Needs to be larger than 100 us, otherwise no retries are done.
1017  // Introduced in Android 11.
1018  optional uint32 block_client_timeout_us = 14;
1019
1020  // Do not profile processes from startup, only match already running
1021  // processes.
1022  //
1023  // Can not be set at the same time as no_running.
1024  // Introduced in Android 11.
1025  optional bool no_startup = 10;
1026
1027  // Do not profile running processes. Only match processes on startup.
1028  //
1029  // Can not be set at the same time as no_startup.
1030  // Introduced in Android 11.
1031  optional bool no_running = 11;
1032
1033  // deprecated idle_allocations.
1034  reserved 12;
1035
1036  // Cause heapprofd to emit a single dump at the end, showing the memory usage
1037  // at the point in time when the sampled heap usage of the process was at its
1038  // maximum. This causes ProfilePacket.HeapSample.self_max to be set, and
1039  // self_allocated and self_freed to not be set.
1040  // Introduced in Android 11.
1041  optional bool dump_at_max = 13;
1042
1043  // FEATURE FLAGS. THERE BE DRAGONS.
1044
1045  // Escape hatch if the session is being torn down because of a forked child
1046  // that shares memory space, but is not correctly identified as a vforked
1047  // child.
1048  // Introduced in Android 11.
1049  optional bool disable_fork_teardown = 18;
1050
1051  // We try to automatically detect when a target applicatation vforks but then
1052  // does a memory allocation (or free). This auto-detection can be disabled
1053  // with this.
1054  // Introduced in Android 11.
1055  optional bool disable_vfork_detection = 19;
1056}
1057
1058// End of protos/perfetto/config/profiling/heapprofd_config.proto
1059
1060// Begin of protos/perfetto/config/profiling/java_hprof_config.proto
1061
1062// Configuration for managed app heap graph snapshots.
1063message JavaHprofConfig {
1064  // If dump_interval_ms != 0, the following configuration is used.
1065  message ContinuousDumpConfig {
1066    // ms to wait before first continuous dump.
1067    // A dump is always created at the beginning of the trace.
1068    optional uint32 dump_phase_ms = 1;
1069    // ms to wait between following dumps.
1070    optional uint32 dump_interval_ms = 2;
1071    // If true, scans all the processes to find `process_cmdline` and filter by
1072    // `min_anonymous_memory_kb` only at data source start. Default on Android
1073    // S-.
1074    //
1075    // If false, rescans all the processes to find on every dump. Default on
1076    // Android T+.
1077    optional bool scan_pids_only_on_start = 3;
1078  }
1079
1080  // Command line allowlist, matched against the /proc/<pid>/cmdline (not the
1081  // comm string). The semantics of this field were changed since its original
1082  // introduction.
1083  //
1084  // On Android T+ (13+), this field can specify a single wildcard (*), and
1085  // the profiler will attempt to match it in two possible ways:
1086  // * if the pattern starts with a '/', then it is matched against the first
1087  //   segment of the cmdline (i.e. argv0). For example "/bin/e*" would match
1088  //   "/bin/echo".
1089  // * otherwise the pattern is matched against the part of argv0
1090  //   corresponding to the binary name (this is unrelated to /proc/pid/exe).
1091  //   For example "echo" would match "/bin/echo".
1092  //
1093  // On Android S (12) and below, both this pattern and /proc/pid/cmdline get
1094  // normalized prior to an exact string comparison. Normalization is as
1095  // follows: (1) trim everything beyond the first null or "@" byte; (2) if
1096  // the string contains forward slashes, trim everything up to and including
1097  // the last one.
1098  //
1099  // Implementation note: in either case, at most 511 characters of cmdline
1100  // are considered.
1101  repeated string process_cmdline = 1;
1102
1103  // For watermark based triggering or local debugging.
1104  repeated uint64 pid = 2;
1105
1106  // Only profile target if it was installed by one of the packages given.
1107  // Special values are:
1108  // * @system: installed on the system partition
1109  // * @product: installed on the product partition
1110  // * @null: sideloaded
1111  // Supported on Android 12+.
1112  repeated string target_installed_by = 7;
1113
1114  // Dump at a predefined interval.
1115  optional ContinuousDumpConfig continuous_dump_config = 3;
1116
1117  // Do not profile processes whose anon RSS + swap < given value.
1118  optional uint32 min_anonymous_memory_kb = 4;
1119
1120  // Include the process' /proc/self/smaps.
1121  // This only shows maps that:
1122  // * start with /system
1123  // * start with /vendor
1124  // * start with /data/app
1125  // * contain "extracted in memory from Y", where Y matches any of the above
1126  optional bool dump_smaps = 5;
1127
1128  // Exclude objects of the following types from the profile. This can be
1129  // useful if lots of uninteresting objects, e.g. "sun.misc.Cleaner".
1130  repeated string ignored_types = 6;
1131}
1132
1133// End of protos/perfetto/config/profiling/java_hprof_config.proto
1134
1135// Begin of protos/perfetto/common/perf_events.proto
1136
1137// Next id: 12
1138message PerfEvents {
1139  // What event to sample on, and how often. Commented from the perspective of
1140  // its use in |PerfEventConfig|.
1141  message Timebase {
1142    // How often the per-cpu sampling will occur. Not guaranteed to be honored
1143    // as the kernel can throttle the sampling rate if it's too high.
1144    // If unset, an implementation-defined default is used.
1145    oneof interval {
1146      // Per-cpu sampling frequency in Hz, as requested from the kernel. Not the
1147      // same as 1/period.
1148      // Details: the actual sampling will still be based on a period, but the
1149      // kernel will dynamically adjust it based on the observed event rate, to
1150      // approximate this frequency. Works best with steady-rate events like
1151      // timers.
1152      uint64 frequency = 2;
1153
1154      // Per-cpu sampling will occur every |period| counts of |event|.
1155      // Prefer |frequency| by default, as it's easier to oversample with a
1156      // fixed period.
1157      uint64 period = 1;
1158    }
1159
1160    // Counting event to use as a timebase for the sampling.
1161    // If unset, implies the CPU timer (SW_CPU_CLOCK) as the event,
1162    // which is what you usually want.
1163    // See common/perf_events.proto for the definitions.
1164    oneof event {
1165      Counter counter = 4;
1166      Tracepoint tracepoint = 3;
1167      RawEvent raw_event = 5;
1168    }
1169
1170    // If set, samples will be timestamped with the given clock.
1171    // If unset, the clock is chosen by the implementation.
1172    // For software events, prefer PERF_CLOCK_BOOTTIME. However it cannot be
1173    // used for hardware events (due to interrupt safety), for which the
1174    // recommendation is to use one of the monotonic clocks.
1175    optional PerfClock timestamp_clock = 11;
1176
1177    // Optional arbitrary name for the event, to identify it in the parsed
1178    // trace. Does *not* affect the profiling itself. If unset, the trace
1179    // parser will choose a suitable name.
1180    optional string name = 10;
1181  }
1182
1183  // Builtin counter names from the uapi header. Commented with their perf tool
1184  // aliases.
1185  // TODO(rsavitski): consider generating enums for cache events (should be
1186  // finite), and generally make this list as extensive as possible. Excluding
1187  // things like dynamic PMUs since those don't fit into a static enum.
1188  // Next id: 21
1189  enum Counter {
1190    UNKNOWN_COUNTER = 0;
1191
1192    // cpu-clock
1193    SW_CPU_CLOCK = 1;
1194    // page-faults, faults
1195    SW_PAGE_FAULTS = 2;
1196    // task-clock
1197    SW_TASK_CLOCK = 3;
1198    // context-switches, cs
1199    SW_CONTEXT_SWITCHES = 4;
1200    // cpu-migrations, migrations
1201    SW_CPU_MIGRATIONS = 5;
1202    // minor-faults
1203    SW_PAGE_FAULTS_MIN = 6;
1204    // major-faults
1205    SW_PAGE_FAULTS_MAJ = 7;
1206    // alignment-faults
1207    SW_ALIGNMENT_FAULTS = 8;
1208    // emulation-faults
1209    SW_EMULATION_FAULTS = 9;
1210    // dummy
1211    SW_DUMMY = 20;
1212
1213    // cpu-cycles, cycles
1214    HW_CPU_CYCLES = 10;
1215    // instructions
1216    HW_INSTRUCTIONS = 11;
1217    // cache-references
1218    HW_CACHE_REFERENCES = 12;
1219    // cache-misses
1220    HW_CACHE_MISSES = 13;
1221    // branch-instructions, branches
1222    HW_BRANCH_INSTRUCTIONS = 14;
1223    // branch-misses
1224    HW_BRANCH_MISSES = 15;
1225    // bus-cycles
1226    HW_BUS_CYCLES = 16;
1227    // stalled-cycles-frontend, idle-cycles-frontend
1228    HW_STALLED_CYCLES_FRONTEND = 17;
1229    // stalled-cycles-backend, idle-cycles-backend
1230    HW_STALLED_CYCLES_BACKEND = 18;
1231    // ref-cycles
1232    HW_REF_CPU_CYCLES = 19;
1233  }
1234
1235  message Tracepoint {
1236    // Group and name for the tracepoint, acceptable forms:
1237    // * "sched/sched_switch"
1238    // * "sched:sched_switch"
1239    optional string name = 1;
1240
1241    // Optional field-level filter for the tracepoint. Only events matching this
1242    // filter will be counted (and therefore contribute to the sampling period).
1243    // Example: "prev_pid >= 42 && next_pid == 0".
1244    // For full syntax, see kernel documentation on "Event filtering":
1245    // https://www.kernel.org/doc/Documentation/trace/events.txt
1246    optional string filter = 2;
1247  }
1248
1249  // Syscall-level description of the event, propagated to the perf_event_attr
1250  // struct. Primarily for local use-cases, since the event availability and
1251  // encoding is hardware-specific.
1252  message RawEvent {
1253    optional uint32 type = 1;
1254    optional uint64 config = 2;
1255    optional uint64 config1 = 3;
1256    optional uint64 config2 = 4;
1257  }
1258
1259  // Subset of clocks that is supported by perf timestamping.
1260  // CLOCK_TAI is excluded since it's not expected to be used in practice, but
1261  // would require additions to the trace clock synchronisation logic.
1262  enum PerfClock {
1263    UNKNOWN_PERF_CLOCK = 0;
1264    PERF_CLOCK_REALTIME = 1;
1265    PERF_CLOCK_MONOTONIC = 2;
1266    PERF_CLOCK_MONOTONIC_RAW = 3;
1267    PERF_CLOCK_BOOTTIME = 4;
1268  }
1269}
1270
1271// End of protos/perfetto/common/perf_events.proto
1272
1273// Begin of protos/perfetto/config/profiling/perf_event_config.proto
1274
1275// Configuration for the traced_perf profiler.
1276//
1277// Example config for basic cpu profiling:
1278//   perf_event_config {
1279//     timebase {
1280//       frequency: 80
1281//     }
1282//     callstack_sampling {
1283//       scope {
1284//         target_cmdline: "surfaceflinger"
1285//         target_cmdline: "system_server"
1286//       }
1287//       kernel_frames: true
1288//     }
1289//   }
1290//
1291// Next id: 19
1292message PerfEventConfig {
1293  // What event to sample on, and how often.
1294  // Defined in common/perf_events.proto.
1295  optional PerfEvents.Timebase timebase = 15;
1296
1297  // If set, the profiler will sample userspace processes' callstacks at the
1298  // interval specified by the |timebase|.
1299  // If unset, the profiler will record only the event counts.
1300  optional CallstackSampling callstack_sampling = 16;
1301
1302  //
1303  // Kernel <-> userspace ring buffer options:
1304  //
1305
1306  // How often the per-cpu ring buffers are read by the producer.
1307  // If unset, an implementation-defined default is used.
1308  optional uint32 ring_buffer_read_period_ms = 8;
1309
1310  // Size (in 4k pages) of each per-cpu ring buffer that is filled by the
1311  // kernel. If set, must be a power of two.
1312  // If unset, an implementation-defined default is used.
1313  optional uint32 ring_buffer_pages = 3;
1314
1315  //
1316  // Daemon's resource usage limits:
1317  //
1318
1319  // Drop samples if the heap memory held by the samples in the unwinder queue
1320  // is above the given limit. This counts the memory across all concurrent data
1321  // sources (not just this one's), and there is no fairness guarantee - the
1322  // whole quota might be used up by a concurrent source.
1323  optional uint64 max_enqueued_footprint_kb = 17;
1324
1325  // Stop the data source if traced_perf's combined {RssAnon + Swap} memory
1326  // footprint exceeds this value.
1327  optional uint32 max_daemon_memory_kb = 13;
1328
1329  //
1330  // Uncommon options:
1331  //
1332
1333  // Timeout for the remote /proc/<pid>/{maps,mem} file descriptors for a
1334  // sampled process. This is primarily for Android, where this lookup is
1335  // asynchronous. As long as the producer is waiting, the associated samples
1336  // will be kept enqueued (putting pressure on the capacity of the shared
1337  // unwinding queue). Once a lookup for a process expires, all associated
1338  // samples are discarded. However, if the lookup still succeeds after the
1339  // timeout, future samples will be handled normally.
1340  // If unset, an implementation-defined default is used.
1341  optional uint32 remote_descriptor_timeout_ms = 9;
1342
1343  // Optional period for clearing state cached by the unwinder. This is a heavy
1344  // operation that is only necessary for traces that target a wide set of
1345  // processes, and require the memory footprint to be reset periodically.
1346  // If unset, the cached state will not be cleared.
1347  optional uint32 unwind_state_clear_period_ms = 10;
1348
1349  // If set, only profile target if it was installed by a package with one of
1350  // these names. Special values:
1351  // * "@system": installed on the system partition
1352  // * "@product": installed on the product partition
1353  // * "@null": sideloaded
1354  // Supported on Android 12+.
1355  repeated string target_installed_by = 18;
1356
1357  //
1358  // Deprecated (superseded by options above):
1359  //
1360  // Do not set *any* of these fields in new configs.
1361  //
1362
1363  // Note: legacy configs had to set |all_cpus| to true to pass parsing.
1364  // We rely on this to detect such configs.
1365  optional bool all_cpus = 1;
1366  optional uint32 sampling_frequency = 2;
1367  optional bool kernel_frames = 12;
1368  repeated int32 target_pid = 4;
1369  repeated string target_cmdline = 5;
1370  repeated int32 exclude_pid = 6;
1371  repeated string exclude_cmdline = 7;
1372  optional uint32 additional_cmdline_count = 11;
1373  // previously |tracepoint|
1374  reserved 14;
1375
1376  //
1377  // Sub-messages (nested for generated code namespacing).
1378  //
1379
1380  message CallstackSampling {
1381    // Defines a set of processes for which samples are retained/skipped. If
1382    // unset, all samples are kept, but beware that it will be very heavy on the
1383    // stack unwinder, which might start dropping samples due to overload.
1384    optional Scope scope = 1;
1385
1386    // If true, callstacks will include the kernel-space frames. Such frames can
1387    // be identified by a magical "kernel" string as their mapping name.
1388    // Requires traced_perf to be running as root, or kptr_restrict to have been
1389    // manually unrestricted. On Android, the platform should do the right thing
1390    // on debug builds.
1391    // This does *not* disclose KASLR, as only the function names are emitted.
1392    optional bool kernel_frames = 2;
1393
1394    // Whether to record and unwind userspace callstacks. If unset, defaults to
1395    // including userspace (UNWIND_DWARF) both for backwards compatibility and
1396    // as the most common default (this defaulting is only applicable if the
1397    // outer CallstackSampling message is explicitly set).
1398    optional UnwindMode user_frames = 3;
1399  }
1400
1401  message Scope {
1402    // Process ID (TGID) allowlist. If this list is not empty, only matching
1403    // samples will be retained. If multiple allow/deny-lists are
1404    // specified by the config, then all of them are evaluated for each sampled
1405    // process.
1406    repeated int32 target_pid = 1;
1407
1408    // Command line allowlist, matched against the /proc/<pid>/cmdline (not the
1409    // comm string). The semantics of this field were changed since its original
1410    // introduction.
1411    //
1412    // On Android T+ (13+), this field can specify a single wildcard (*), and
1413    // the profiler will attempt to match it in two possible ways:
1414    // * if the pattern starts with a '/', then it is matched against the first
1415    //   segment of the cmdline (i.e. argv0). For example "/bin/e*" would match
1416    //   "/bin/echo".
1417    // * otherwise the pattern is matched against the part of argv0
1418    //   corresponding to the binary name (this is unrelated to /proc/pid/exe).
1419    //   For example "echo" would match "/bin/echo".
1420    //
1421    // On Android S (12) and below, both this pattern and /proc/pid/cmdline get
1422    // normalized prior to an exact string comparison. Normalization is as
1423    // follows: (1) trim everything beyond the first null or "@" byte; (2) if
1424    // the string contains forward slashes, trim everything up to and including
1425    // the last one.
1426    //
1427    // Implementation note: in either case, at most 511 characters of cmdline
1428    // are considered.
1429    repeated string target_cmdline = 2;
1430
1431    // List of excluded pids.
1432    repeated int32 exclude_pid = 3;
1433
1434    // List of excluded cmdlines. See description of |target_cmdline| for how
1435    // this is handled.
1436    repeated string exclude_cmdline = 4;
1437
1438    // Niche features for systemwide callstacks:
1439
1440    // Number of additional command lines to sample. Only those which are
1441    // neither explicitly included nor excluded will be considered. Processes
1442    // are accepted on a first come, first served basis.
1443    optional uint32 additional_cmdline_count = 5;
1444
1445    // If set to N, all encountered processes will be put into one of the N
1446    // possible bins, and only one randomly-chosen bin will be selected for
1447    // unwinding. The binning is simply "pid % N", under the assumption that
1448    // low-order bits of pids are roughly uniformly distributed. Other explicit
1449    // inclusions/exclusions in this |Scope| message are still respected.
1450    //
1451    // The profiler will report the chosen shard in PerfSampleDefaults, and the
1452    // values will be queryable in trace processor under the "stats" table as
1453    // "perf_process_shard_count" and "perf_chosen_process_shard".
1454    //
1455    // NB: all data sources in a config that set |process_shard_count| must set
1456    // it to the same value. The profiler will choose one bin for all those data
1457    // sources.
1458    optional uint32 process_shard_count = 6;
1459  }
1460
1461  // Userspace unwinding mode. A possible future addition is kernel-unwound
1462  // callchains for frame pointer based systems.
1463  enum UnwindMode {
1464    UNWIND_UNKNOWN = 0;
1465    // Do not unwind userspace:
1466    UNWIND_SKIP = 1;
1467    // Use libunwindstack (default):
1468    UNWIND_DWARF = 2;
1469  }
1470}
1471
1472// End of protos/perfetto/config/profiling/perf_event_config.proto
1473
1474// Begin of protos/perfetto/config/statsd/atom_ids.proto
1475
1476// This enum is obtained by post-processing
1477// AOSP/frameworks/proto_logging/stats/atoms.proto through
1478// AOSP/external/perfetto/tools/update-statsd-descriptor, which extracts one
1479// enum value for each proto field defined in the upstream atoms.proto.
1480enum AtomId {
1481  ATOM_UNSPECIFIED = 0;
1482  ATOM_BLE_SCAN_STATE_CHANGED = 2;
1483  ATOM_PROCESS_STATE_CHANGED = 3;
1484  ATOM_BLE_SCAN_RESULT_RECEIVED = 4;
1485  ATOM_SENSOR_STATE_CHANGED = 5;
1486  ATOM_GPS_SCAN_STATE_CHANGED = 6;
1487  ATOM_SYNC_STATE_CHANGED = 7;
1488  ATOM_SCHEDULED_JOB_STATE_CHANGED = 8;
1489  ATOM_SCREEN_BRIGHTNESS_CHANGED = 9;
1490  ATOM_WAKELOCK_STATE_CHANGED = 10;
1491  ATOM_LONG_PARTIAL_WAKELOCK_STATE_CHANGED = 11;
1492  ATOM_MOBILE_RADIO_POWER_STATE_CHANGED = 12;
1493  ATOM_WIFI_RADIO_POWER_STATE_CHANGED = 13;
1494  ATOM_ACTIVITY_MANAGER_SLEEP_STATE_CHANGED = 14;
1495  ATOM_MEMORY_FACTOR_STATE_CHANGED = 15;
1496  ATOM_EXCESSIVE_CPU_USAGE_REPORTED = 16;
1497  ATOM_CACHED_KILL_REPORTED = 17;
1498  ATOM_PROCESS_MEMORY_STAT_REPORTED = 18;
1499  ATOM_LAUNCHER_EVENT = 19;
1500  ATOM_BATTERY_SAVER_MODE_STATE_CHANGED = 20;
1501  ATOM_DEVICE_IDLE_MODE_STATE_CHANGED = 21;
1502  ATOM_DEVICE_IDLING_MODE_STATE_CHANGED = 22;
1503  ATOM_AUDIO_STATE_CHANGED = 23;
1504  ATOM_MEDIA_CODEC_STATE_CHANGED = 24;
1505  ATOM_CAMERA_STATE_CHANGED = 25;
1506  ATOM_FLASHLIGHT_STATE_CHANGED = 26;
1507  ATOM_UID_PROCESS_STATE_CHANGED = 27;
1508  ATOM_PROCESS_LIFE_CYCLE_STATE_CHANGED = 28;
1509  ATOM_SCREEN_STATE_CHANGED = 29;
1510  ATOM_BATTERY_LEVEL_CHANGED = 30;
1511  ATOM_CHARGING_STATE_CHANGED = 31;
1512  ATOM_PLUGGED_STATE_CHANGED = 32;
1513  ATOM_INTERACTIVE_STATE_CHANGED = 33;
1514  ATOM_TOUCH_EVENT_REPORTED = 34;
1515  ATOM_WAKEUP_ALARM_OCCURRED = 35;
1516  ATOM_KERNEL_WAKEUP_REPORTED = 36;
1517  ATOM_WIFI_LOCK_STATE_CHANGED = 37;
1518  ATOM_WIFI_SIGNAL_STRENGTH_CHANGED = 38;
1519  ATOM_WIFI_SCAN_STATE_CHANGED = 39;
1520  ATOM_PHONE_SIGNAL_STRENGTH_CHANGED = 40;
1521  ATOM_SETTING_CHANGED = 41;
1522  ATOM_ACTIVITY_FOREGROUND_STATE_CHANGED = 42;
1523  ATOM_ISOLATED_UID_CHANGED = 43;
1524  ATOM_PACKET_WAKEUP_OCCURRED = 44;
1525  ATOM_WALL_CLOCK_TIME_SHIFTED = 45;
1526  ATOM_ANOMALY_DETECTED = 46;
1527  ATOM_APP_BREADCRUMB_REPORTED = 47;
1528  ATOM_APP_START_OCCURRED = 48;
1529  ATOM_APP_START_CANCELED = 49;
1530  ATOM_APP_START_FULLY_DRAWN = 50;
1531  ATOM_LMK_KILL_OCCURRED = 51;
1532  ATOM_PICTURE_IN_PICTURE_STATE_CHANGED = 52;
1533  ATOM_WIFI_MULTICAST_LOCK_STATE_CHANGED = 53;
1534  ATOM_LMK_STATE_CHANGED = 54;
1535  ATOM_APP_START_MEMORY_STATE_CAPTURED = 55;
1536  ATOM_SHUTDOWN_SEQUENCE_REPORTED = 56;
1537  ATOM_BOOT_SEQUENCE_REPORTED = 57;
1538  ATOM_DAVEY_OCCURRED = 58;
1539  ATOM_OVERLAY_STATE_CHANGED = 59;
1540  ATOM_FOREGROUND_SERVICE_STATE_CHANGED = 60;
1541  ATOM_CALL_STATE_CHANGED = 61;
1542  ATOM_KEYGUARD_STATE_CHANGED = 62;
1543  ATOM_KEYGUARD_BOUNCER_STATE_CHANGED = 63;
1544  ATOM_KEYGUARD_BOUNCER_PASSWORD_ENTERED = 64;
1545  ATOM_APP_DIED = 65;
1546  ATOM_RESOURCE_CONFIGURATION_CHANGED = 66;
1547  ATOM_BLUETOOTH_ENABLED_STATE_CHANGED = 67;
1548  ATOM_BLUETOOTH_CONNECTION_STATE_CHANGED = 68;
1549  ATOM_GPS_SIGNAL_QUALITY_CHANGED = 69;
1550  ATOM_USB_CONNECTOR_STATE_CHANGED = 70;
1551  ATOM_SPEAKER_IMPEDANCE_REPORTED = 71;
1552  ATOM_HARDWARE_FAILED = 72;
1553  ATOM_PHYSICAL_DROP_DETECTED = 73;
1554  ATOM_CHARGE_CYCLES_REPORTED = 74;
1555  ATOM_MOBILE_CONNECTION_STATE_CHANGED = 75;
1556  ATOM_MOBILE_RADIO_TECHNOLOGY_CHANGED = 76;
1557  ATOM_USB_DEVICE_ATTACHED = 77;
1558  ATOM_APP_CRASH_OCCURRED = 78;
1559  ATOM_ANR_OCCURRED = 79;
1560  ATOM_WTF_OCCURRED = 80;
1561  ATOM_LOW_MEM_REPORTED = 81;
1562  ATOM_GENERIC_ATOM = 82;
1563  ATOM_VIBRATOR_STATE_CHANGED = 84;
1564  ATOM_DEFERRED_JOB_STATS_REPORTED = 85;
1565  ATOM_THERMAL_THROTTLING = 86;
1566  ATOM_BIOMETRIC_ACQUIRED = 87;
1567  ATOM_BIOMETRIC_AUTHENTICATED = 88;
1568  ATOM_BIOMETRIC_ERROR_OCCURRED = 89;
1569  ATOM_UI_EVENT_REPORTED = 90;
1570  ATOM_BATTERY_HEALTH_SNAPSHOT = 91;
1571  ATOM_SLOW_IO = 92;
1572  ATOM_BATTERY_CAUSED_SHUTDOWN = 93;
1573  ATOM_PHONE_SERVICE_STATE_CHANGED = 94;
1574  ATOM_PHONE_STATE_CHANGED = 95;
1575  ATOM_USER_RESTRICTION_CHANGED = 96;
1576  ATOM_SETTINGS_UI_CHANGED = 97;
1577  ATOM_CONNECTIVITY_STATE_CHANGED = 98;
1578  ATOM_SERVICE_STATE_CHANGED = 99;
1579  ATOM_SERVICE_LAUNCH_REPORTED = 100;
1580  ATOM_FLAG_FLIP_UPDATE_OCCURRED = 101;
1581  ATOM_BINARY_PUSH_STATE_CHANGED = 102;
1582  ATOM_DEVICE_POLICY_EVENT = 103;
1583  ATOM_DOCS_UI_FILE_OP_CANCELED = 104;
1584  ATOM_DOCS_UI_FILE_OP_COPY_MOVE_MODE_REPORTED = 105;
1585  ATOM_DOCS_UI_FILE_OP_FAILURE = 106;
1586  ATOM_DOCS_UI_PROVIDER_FILE_OP = 107;
1587  ATOM_DOCS_UI_INVALID_SCOPED_ACCESS_REQUEST = 108;
1588  ATOM_DOCS_UI_LAUNCH_REPORTED = 109;
1589  ATOM_DOCS_UI_ROOT_VISITED = 110;
1590  ATOM_DOCS_UI_STARTUP_MS = 111;
1591  ATOM_DOCS_UI_USER_ACTION_REPORTED = 112;
1592  ATOM_WIFI_ENABLED_STATE_CHANGED = 113;
1593  ATOM_WIFI_RUNNING_STATE_CHANGED = 114;
1594  ATOM_APP_COMPACTED = 115;
1595  ATOM_NETWORK_DNS_EVENT_REPORTED = 116;
1596  ATOM_DOCS_UI_PICKER_LAUNCHED_FROM_REPORTED = 117;
1597  ATOM_DOCS_UI_PICK_RESULT_REPORTED = 118;
1598  ATOM_DOCS_UI_SEARCH_MODE_REPORTED = 119;
1599  ATOM_DOCS_UI_SEARCH_TYPE_REPORTED = 120;
1600  ATOM_DATA_STALL_EVENT = 121;
1601  ATOM_RESCUE_PARTY_RESET_REPORTED = 122;
1602  ATOM_SIGNED_CONFIG_REPORTED = 123;
1603  ATOM_GNSS_NI_EVENT_REPORTED = 124;
1604  ATOM_BLUETOOTH_LINK_LAYER_CONNECTION_EVENT = 125;
1605  ATOM_BLUETOOTH_ACL_CONNECTION_STATE_CHANGED = 126;
1606  ATOM_BLUETOOTH_SCO_CONNECTION_STATE_CHANGED = 127;
1607  ATOM_APP_DOWNGRADED = 128;
1608  ATOM_APP_OPTIMIZED_AFTER_DOWNGRADED = 129;
1609  ATOM_LOW_STORAGE_STATE_CHANGED = 130;
1610  ATOM_GNSS_NFW_NOTIFICATION_REPORTED = 131;
1611  ATOM_GNSS_CONFIGURATION_REPORTED = 132;
1612  ATOM_USB_PORT_OVERHEAT_EVENT_REPORTED = 133;
1613  ATOM_NFC_ERROR_OCCURRED = 134;
1614  ATOM_NFC_STATE_CHANGED = 135;
1615  ATOM_NFC_BEAM_OCCURRED = 136;
1616  ATOM_NFC_CARDEMULATION_OCCURRED = 137;
1617  ATOM_NFC_TAG_OCCURRED = 138;
1618  ATOM_NFC_HCE_TRANSACTION_OCCURRED = 139;
1619  ATOM_SE_STATE_CHANGED = 140;
1620  ATOM_SE_OMAPI_REPORTED = 141;
1621  ATOM_BROADCAST_DISPATCH_LATENCY_REPORTED = 142;
1622  ATOM_ATTENTION_MANAGER_SERVICE_RESULT_REPORTED = 143;
1623  ATOM_ADB_CONNECTION_CHANGED = 144;
1624  ATOM_SPEECH_DSP_STAT_REPORTED = 145;
1625  ATOM_USB_CONTAMINANT_REPORTED = 146;
1626  ATOM_WATCHDOG_ROLLBACK_OCCURRED = 147;
1627  ATOM_BIOMETRIC_SYSTEM_HEALTH_ISSUE_DETECTED = 148;
1628  ATOM_BUBBLE_UI_CHANGED = 149;
1629  ATOM_SCHEDULED_JOB_CONSTRAINT_CHANGED = 150;
1630  ATOM_BLUETOOTH_ACTIVE_DEVICE_CHANGED = 151;
1631  ATOM_BLUETOOTH_A2DP_PLAYBACK_STATE_CHANGED = 152;
1632  ATOM_BLUETOOTH_A2DP_CODEC_CONFIG_CHANGED = 153;
1633  ATOM_BLUETOOTH_A2DP_CODEC_CAPABILITY_CHANGED = 154;
1634  ATOM_BLUETOOTH_A2DP_AUDIO_UNDERRUN_REPORTED = 155;
1635  ATOM_BLUETOOTH_A2DP_AUDIO_OVERRUN_REPORTED = 156;
1636  ATOM_BLUETOOTH_DEVICE_RSSI_REPORTED = 157;
1637  ATOM_BLUETOOTH_DEVICE_FAILED_CONTACT_COUNTER_REPORTED = 158;
1638  ATOM_BLUETOOTH_DEVICE_TX_POWER_LEVEL_REPORTED = 159;
1639  ATOM_BLUETOOTH_HCI_TIMEOUT_REPORTED = 160;
1640  ATOM_BLUETOOTH_QUALITY_REPORT_REPORTED = 161;
1641  ATOM_BLUETOOTH_DEVICE_INFO_REPORTED = 162;
1642  ATOM_BLUETOOTH_REMOTE_VERSION_INFO_REPORTED = 163;
1643  ATOM_BLUETOOTH_SDP_ATTRIBUTE_REPORTED = 164;
1644  ATOM_BLUETOOTH_BOND_STATE_CHANGED = 165;
1645  ATOM_BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED = 166;
1646  ATOM_BLUETOOTH_SMP_PAIRING_EVENT_REPORTED = 167;
1647  ATOM_SCREEN_TIMEOUT_EXTENSION_REPORTED = 168;
1648  ATOM_PROCESS_START_TIME = 169;
1649  ATOM_PERMISSION_GRANT_REQUEST_RESULT_REPORTED = 170;
1650  ATOM_BLUETOOTH_SOCKET_CONNECTION_STATE_CHANGED = 171;
1651  ATOM_DEVICE_IDENTIFIER_ACCESS_DENIED = 172;
1652  ATOM_BUBBLE_DEVELOPER_ERROR_REPORTED = 173;
1653  ATOM_ASSIST_GESTURE_STAGE_REPORTED = 174;
1654  ATOM_ASSIST_GESTURE_FEEDBACK_REPORTED = 175;
1655  ATOM_ASSIST_GESTURE_PROGRESS_REPORTED = 176;
1656  ATOM_TOUCH_GESTURE_CLASSIFIED = 177;
1657  ATOM_HIDDEN_API_USED = 178;
1658  ATOM_STYLE_UI_CHANGED = 179;
1659  ATOM_PRIVACY_INDICATORS_INTERACTED = 180;
1660  ATOM_APP_INSTALL_ON_EXTERNAL_STORAGE_REPORTED = 181;
1661  ATOM_NETWORK_STACK_REPORTED = 182;
1662  ATOM_APP_MOVED_STORAGE_REPORTED = 183;
1663  ATOM_BIOMETRIC_ENROLLED = 184;
1664  ATOM_SYSTEM_SERVER_WATCHDOG_OCCURRED = 185;
1665  ATOM_TOMB_STONE_OCCURRED = 186;
1666  ATOM_BLUETOOTH_CLASS_OF_DEVICE_REPORTED = 187;
1667  ATOM_INTELLIGENCE_EVENT_REPORTED = 188;
1668  ATOM_THERMAL_THROTTLING_SEVERITY_STATE_CHANGED = 189;
1669  ATOM_ROLE_REQUEST_RESULT_REPORTED = 190;
1670  ATOM_MEDIAMETRICS_AUDIOPOLICY_REPORTED = 191;
1671  ATOM_MEDIAMETRICS_AUDIORECORD_REPORTED = 192;
1672  ATOM_MEDIAMETRICS_AUDIOTHREAD_REPORTED = 193;
1673  ATOM_MEDIAMETRICS_AUDIOTRACK_REPORTED = 194;
1674  ATOM_MEDIAMETRICS_CODEC_REPORTED = 195;
1675  ATOM_MEDIAMETRICS_DRM_WIDEVINE_REPORTED = 196;
1676  ATOM_MEDIAMETRICS_EXTRACTOR_REPORTED = 197;
1677  ATOM_MEDIAMETRICS_MEDIADRM_REPORTED = 198;
1678  ATOM_MEDIAMETRICS_NUPLAYER_REPORTED = 199;
1679  ATOM_MEDIAMETRICS_RECORDER_REPORTED = 200;
1680  ATOM_MEDIAMETRICS_DRMMANAGER_REPORTED = 201;
1681  ATOM_CAR_POWER_STATE_CHANGED = 203;
1682  ATOM_GARAGE_MODE_INFO = 204;
1683  ATOM_TEST_ATOM_REPORTED = 205;
1684  ATOM_CONTENT_CAPTURE_CALLER_MISMATCH_REPORTED = 206;
1685  ATOM_CONTENT_CAPTURE_SERVICE_EVENTS = 207;
1686  ATOM_CONTENT_CAPTURE_SESSION_EVENTS = 208;
1687  ATOM_CONTENT_CAPTURE_FLUSHED = 209;
1688  ATOM_LOCATION_MANAGER_API_USAGE_REPORTED = 210;
1689  ATOM_REVIEW_PERMISSIONS_FRAGMENT_RESULT_REPORTED = 211;
1690  ATOM_RUNTIME_PERMISSIONS_UPGRADE_RESULT = 212;
1691  ATOM_GRANT_PERMISSIONS_ACTIVITY_BUTTON_ACTIONS = 213;
1692  ATOM_LOCATION_ACCESS_CHECK_NOTIFICATION_ACTION = 214;
1693  ATOM_APP_PERMISSION_FRAGMENT_ACTION_REPORTED = 215;
1694  ATOM_APP_PERMISSION_FRAGMENT_VIEWED = 216;
1695  ATOM_APP_PERMISSIONS_FRAGMENT_VIEWED = 217;
1696  ATOM_PERMISSION_APPS_FRAGMENT_VIEWED = 218;
1697  ATOM_TEXT_SELECTION_EVENT = 219;
1698  ATOM_TEXT_LINKIFY_EVENT = 220;
1699  ATOM_CONVERSATION_ACTIONS_EVENT = 221;
1700  ATOM_LANGUAGE_DETECTION_EVENT = 222;
1701  ATOM_EXCLUSION_RECT_STATE_CHANGED = 223;
1702  ATOM_BACK_GESTURE_REPORTED_REPORTED = 224;
1703  ATOM_UPDATE_ENGINE_UPDATE_ATTEMPT_REPORTED = 225;
1704  ATOM_UPDATE_ENGINE_SUCCESSFUL_UPDATE_REPORTED = 226;
1705  ATOM_CAMERA_ACTION_EVENT = 227;
1706  ATOM_APP_COMPATIBILITY_CHANGE_REPORTED = 228;
1707  ATOM_PERFETTO_UPLOADED = 229;
1708  ATOM_VMS_CLIENT_CONNECTION_STATE_CHANGED = 230;
1709  ATOM_MEDIA_PROVIDER_SCAN_OCCURRED = 233;
1710  ATOM_MEDIA_CONTENT_DELETED = 234;
1711  ATOM_MEDIA_PROVIDER_PERMISSION_REQUESTED = 235;
1712  ATOM_MEDIA_PROVIDER_SCHEMA_CHANGED = 236;
1713  ATOM_MEDIA_PROVIDER_IDLE_MAINTENANCE_FINISHED = 237;
1714  ATOM_REBOOT_ESCROW_RECOVERY_REPORTED = 238;
1715  ATOM_BOOT_TIME_EVENT_DURATION_REPORTED = 239;
1716  ATOM_BOOT_TIME_EVENT_ELAPSED_TIME_REPORTED = 240;
1717  ATOM_BOOT_TIME_EVENT_UTC_TIME_REPORTED = 241;
1718  ATOM_BOOT_TIME_EVENT_ERROR_CODE_REPORTED = 242;
1719  ATOM_USERSPACE_REBOOT_REPORTED = 243;
1720  ATOM_NOTIFICATION_REPORTED = 244;
1721  ATOM_NOTIFICATION_PANEL_REPORTED = 245;
1722  ATOM_NOTIFICATION_CHANNEL_MODIFIED = 246;
1723  ATOM_INTEGRITY_CHECK_RESULT_REPORTED = 247;
1724  ATOM_INTEGRITY_RULES_PUSHED = 248;
1725  ATOM_CB_MESSAGE_REPORTED = 249;
1726  ATOM_CB_MESSAGE_ERROR = 250;
1727  ATOM_WIFI_HEALTH_STAT_REPORTED = 251;
1728  ATOM_WIFI_FAILURE_STAT_REPORTED = 252;
1729  ATOM_WIFI_CONNECTION_RESULT_REPORTED = 253;
1730  ATOM_APP_FREEZE_CHANGED = 254;
1731  ATOM_SNAPSHOT_MERGE_REPORTED = 255;
1732  ATOM_FOREGROUND_SERVICE_APP_OP_SESSION_ENDED = 256;
1733  ATOM_DISPLAY_JANK_REPORTED = 257;
1734  ATOM_APP_STANDBY_BUCKET_CHANGED = 258;
1735  ATOM_SHARESHEET_STARTED = 259;
1736  ATOM_RANKING_SELECTED = 260;
1737  ATOM_TVSETTINGS_UI_INTERACTED = 261;
1738  ATOM_LAUNCHER_SNAPSHOT = 262;
1739  ATOM_PACKAGE_INSTALLER_V2_REPORTED = 263;
1740  ATOM_USER_LIFECYCLE_JOURNEY_REPORTED = 264;
1741  ATOM_USER_LIFECYCLE_EVENT_OCCURRED = 265;
1742  ATOM_ACCESSIBILITY_SHORTCUT_REPORTED = 266;
1743  ATOM_ACCESSIBILITY_SERVICE_REPORTED = 267;
1744  ATOM_DOCS_UI_DRAG_AND_DROP_REPORTED = 268;
1745  ATOM_APP_USAGE_EVENT_OCCURRED = 269;
1746  ATOM_AUTO_REVOKE_NOTIFICATION_CLICKED = 270;
1747  ATOM_AUTO_REVOKE_FRAGMENT_APP_VIEWED = 271;
1748  ATOM_AUTO_REVOKED_APP_INTERACTION = 272;
1749  ATOM_APP_PERMISSION_GROUPS_FRAGMENT_AUTO_REVOKE_ACTION = 273;
1750  ATOM_EVS_USAGE_STATS_REPORTED = 274;
1751  ATOM_AUDIO_POWER_USAGE_DATA_REPORTED = 275;
1752  ATOM_TV_TUNER_STATE_CHANGED = 276;
1753  ATOM_MEDIAOUTPUT_OP_SWITCH_REPORTED = 277;
1754  ATOM_CB_MESSAGE_FILTERED = 278;
1755  ATOM_TV_TUNER_DVR_STATUS = 279;
1756  ATOM_TV_CAS_SESSION_OPEN_STATUS = 280;
1757  ATOM_ASSISTANT_INVOCATION_REPORTED = 281;
1758  ATOM_DISPLAY_WAKE_REPORTED = 282;
1759  ATOM_CAR_USER_HAL_MODIFY_USER_REQUEST_REPORTED = 283;
1760  ATOM_CAR_USER_HAL_MODIFY_USER_RESPONSE_REPORTED = 284;
1761  ATOM_CAR_USER_HAL_POST_SWITCH_RESPONSE_REPORTED = 285;
1762  ATOM_CAR_USER_HAL_INITIAL_USER_INFO_REQUEST_REPORTED = 286;
1763  ATOM_CAR_USER_HAL_INITIAL_USER_INFO_RESPONSE_REPORTED = 287;
1764  ATOM_CAR_USER_HAL_USER_ASSOCIATION_REQUEST_REPORTED = 288;
1765  ATOM_CAR_USER_HAL_SET_USER_ASSOCIATION_RESPONSE_REPORTED = 289;
1766  ATOM_NETWORK_IP_PROVISIONING_REPORTED = 290;
1767  ATOM_NETWORK_DHCP_RENEW_REPORTED = 291;
1768  ATOM_NETWORK_VALIDATION_REPORTED = 292;
1769  ATOM_NETWORK_STACK_QUIRK_REPORTED = 293;
1770  ATOM_MEDIAMETRICS_AUDIORECORDDEVICEUSAGE_REPORTED = 294;
1771  ATOM_MEDIAMETRICS_AUDIOTHREADDEVICEUSAGE_REPORTED = 295;
1772  ATOM_MEDIAMETRICS_AUDIOTRACKDEVICEUSAGE_REPORTED = 296;
1773  ATOM_MEDIAMETRICS_AUDIODEVICECONNECTION_REPORTED = 297;
1774  ATOM_BLOB_COMMITTED = 298;
1775  ATOM_BLOB_LEASED = 299;
1776  ATOM_BLOB_OPENED = 300;
1777  ATOM_CONTACTS_PROVIDER_STATUS_REPORTED = 301;
1778  ATOM_KEYSTORE_KEY_EVENT_REPORTED = 302;
1779  ATOM_NETWORK_TETHERING_REPORTED = 303;
1780  ATOM_IME_TOUCH_REPORTED = 304;
1781  ATOM_UI_INTERACTION_FRAME_INFO_REPORTED = 305;
1782  ATOM_UI_ACTION_LATENCY_REPORTED = 306;
1783  ATOM_WIFI_DISCONNECT_REPORTED = 307;
1784  ATOM_WIFI_CONNECTION_STATE_CHANGED = 308;
1785  ATOM_HDMI_CEC_ACTIVE_SOURCE_CHANGED = 309;
1786  ATOM_HDMI_CEC_MESSAGE_REPORTED = 310;
1787  ATOM_AIRPLANE_MODE = 311;
1788  ATOM_MODEM_RESTART = 312;
1789  ATOM_CARRIER_ID_MISMATCH_REPORTED = 313;
1790  ATOM_CARRIER_ID_TABLE_UPDATED = 314;
1791  ATOM_DATA_STALL_RECOVERY_REPORTED = 315;
1792  ATOM_MEDIAMETRICS_MEDIAPARSER_REPORTED = 316;
1793  ATOM_TLS_HANDSHAKE_REPORTED = 317;
1794  ATOM_TEXT_CLASSIFIER_API_USAGE_REPORTED = 318;
1795  ATOM_CAR_WATCHDOG_KILL_STATS_REPORTED = 319;
1796  ATOM_MEDIAMETRICS_PLAYBACK_REPORTED = 320;
1797  ATOM_MEDIA_NETWORK_INFO_CHANGED = 321;
1798  ATOM_MEDIA_PLAYBACK_STATE_CHANGED = 322;
1799  ATOM_MEDIA_PLAYBACK_ERROR_REPORTED = 323;
1800  ATOM_MEDIA_PLAYBACK_TRACK_CHANGED = 324;
1801  ATOM_WIFI_SCAN_REPORTED = 325;
1802  ATOM_WIFI_PNO_SCAN_REPORTED = 326;
1803  ATOM_TIF_TUNE_CHANGED = 327;
1804  ATOM_AUTO_ROTATE_REPORTED = 328;
1805  ATOM_PERFETTO_TRIGGER = 329;
1806  ATOM_TRANSCODING_DATA = 330;
1807  ATOM_IMS_SERVICE_ENTITLEMENT_UPDATED = 331;
1808  ATOM_ART_DATUM_REPORTED = 332;
1809  ATOM_DEVICE_ROTATED = 333;
1810  ATOM_SIM_SPECIFIC_SETTINGS_RESTORED = 334;
1811  ATOM_TEXT_CLASSIFIER_DOWNLOAD_REPORTED = 335;
1812  ATOM_PIN_STORAGE_EVENT = 336;
1813  ATOM_FACE_DOWN_REPORTED = 337;
1814  ATOM_BLUETOOTH_HAL_CRASH_REASON_REPORTED = 338;
1815  ATOM_REBOOT_ESCROW_PREPARATION_REPORTED = 339;
1816  ATOM_REBOOT_ESCROW_LSKF_CAPTURE_REPORTED = 340;
1817  ATOM_REBOOT_ESCROW_REBOOT_REPORTED = 341;
1818  ATOM_BINDER_LATENCY_REPORTED = 342;
1819  ATOM_MEDIAMETRICS_AAUDIOSTREAM_REPORTED = 343;
1820  ATOM_MEDIA_TRANSCODING_SESSION_ENDED = 344;
1821  ATOM_MAGNIFICATION_USAGE_REPORTED = 345;
1822  ATOM_MAGNIFICATION_MODE_WITH_IME_ON_REPORTED = 346;
1823  ATOM_APP_SEARCH_CALL_STATS_REPORTED = 347;
1824  ATOM_APP_SEARCH_PUT_DOCUMENT_STATS_REPORTED = 348;
1825  ATOM_DEVICE_CONTROL_CHANGED = 349;
1826  ATOM_DEVICE_STATE_CHANGED = 350;
1827  ATOM_INPUTDEVICE_REGISTERED = 351;
1828  ATOM_SMARTSPACE_CARD_REPORTED = 352;
1829  ATOM_AUTH_PROMPT_AUTHENTICATE_INVOKED = 353;
1830  ATOM_AUTH_MANAGER_CAN_AUTHENTICATE_INVOKED = 354;
1831  ATOM_AUTH_ENROLL_ACTION_INVOKED = 355;
1832  ATOM_AUTH_DEPRECATED_API_USED = 356;
1833  ATOM_UNATTENDED_REBOOT_OCCURRED = 357;
1834  ATOM_LONG_REBOOT_BLOCKING_REPORTED = 358;
1835  ATOM_LOCATION_TIME_ZONE_PROVIDER_STATE_CHANGED = 359;
1836  ATOM_FDTRACK_EVENT_OCCURRED = 364;
1837  ATOM_TIMEOUT_AUTO_EXTENDED_REPORTED = 365;
1838  ATOM_ODREFRESH_REPORTED = 366;
1839  ATOM_ALARM_BATCH_DELIVERED = 367;
1840  ATOM_ALARM_SCHEDULED = 368;
1841  ATOM_CAR_WATCHDOG_IO_OVERUSE_STATS_REPORTED = 369;
1842  ATOM_USER_LEVEL_HIBERNATION_STATE_CHANGED = 370;
1843  ATOM_APP_SEARCH_INITIALIZE_STATS_REPORTED = 371;
1844  ATOM_APP_SEARCH_QUERY_STATS_REPORTED = 372;
1845  ATOM_APP_PROCESS_DIED = 373;
1846  ATOM_NETWORK_IP_REACHABILITY_MONITOR_REPORTED = 374;
1847  ATOM_SLOW_INPUT_EVENT_REPORTED = 375;
1848  ATOM_ANR_OCCURRED_PROCESSING_STARTED = 376;
1849  ATOM_APP_SEARCH_REMOVE_STATS_REPORTED = 377;
1850  ATOM_MEDIA_CODEC_REPORTED = 378;
1851  ATOM_PERMISSION_USAGE_FRAGMENT_INTERACTION = 379;
1852  ATOM_PERMISSION_DETAILS_INTERACTION = 380;
1853  ATOM_PRIVACY_SENSOR_TOGGLE_INTERACTION = 381;
1854  ATOM_PRIVACY_TOGGLE_DIALOG_INTERACTION = 382;
1855  ATOM_APP_SEARCH_OPTIMIZE_STATS_REPORTED = 383;
1856  ATOM_NON_A11Y_TOOL_SERVICE_WARNING_REPORT = 384;
1857  ATOM_APP_SEARCH_SET_SCHEMA_STATS_REPORTED = 385;
1858  ATOM_APP_COMPAT_STATE_CHANGED = 386;
1859  ATOM_SIZE_COMPAT_RESTART_BUTTON_EVENT_REPORTED = 387;
1860  ATOM_SPLITSCREEN_UI_CHANGED = 388;
1861  ATOM_NETWORK_DNS_HANDSHAKE_REPORTED = 389;
1862  ATOM_BLUETOOTH_CODE_PATH_COUNTER = 390;
1863  ATOM_BLUETOOTH_LE_BATCH_SCAN_REPORT_DELAY = 392;
1864  ATOM_ACCESSIBILITY_FLOATING_MENU_UI_CHANGED = 393;
1865  ATOM_NEURALNETWORKS_COMPILATION_COMPLETED = 394;
1866  ATOM_NEURALNETWORKS_EXECUTION_COMPLETED = 395;
1867  ATOM_NEURALNETWORKS_COMPILATION_FAILED = 396;
1868  ATOM_NEURALNETWORKS_EXECUTION_FAILED = 397;
1869  ATOM_CONTEXT_HUB_BOOTED = 398;
1870  ATOM_CONTEXT_HUB_RESTARTED = 399;
1871  ATOM_CONTEXT_HUB_LOADED_NANOAPP_SNAPSHOT_REPORTED = 400;
1872  ATOM_CHRE_CODE_DOWNLOAD_TRANSACTED = 401;
1873  ATOM_UWB_SESSION_INITED = 402;
1874  ATOM_UWB_SESSION_CLOSED = 403;
1875  ATOM_UWB_FIRST_RANGING_RECEIVED = 404;
1876  ATOM_UWB_RANGING_MEASUREMENT_RECEIVED = 405;
1877  ATOM_TEXT_CLASSIFIER_DOWNLOAD_WORK_SCHEDULED = 406;
1878  ATOM_TEXT_CLASSIFIER_DOWNLOAD_WORK_COMPLETED = 407;
1879  ATOM_CLIPBOARD_CLEARED = 408;
1880  ATOM_VM_CREATION_REQUESTED = 409;
1881  ATOM_NEARBY_DEVICE_SCAN_STATE_CHANGED = 410;
1882  ATOM_CAMERA_COMPAT_CONTROL_EVENT_REPORTED = 411;
1883  ATOM_APPLICATION_LOCALES_CHANGED = 412;
1884  ATOM_MEDIAMETRICS_AUDIOTRACKSTATUS_REPORTED = 413;
1885  ATOM_FOLD_STATE_DURATION_REPORTED = 414;
1886  ATOM_LOCATION_TIME_ZONE_PROVIDER_CONTROLLER_STATE_CHANGED = 415;
1887  ATOM_DISPLAY_HBM_STATE_CHANGED = 416;
1888  ATOM_DISPLAY_HBM_BRIGHTNESS_CHANGED = 417;
1889  ATOM_PERSISTENT_URI_PERMISSIONS_FLUSHED = 418;
1890  ATOM_EARLY_BOOT_COMP_OS_ARTIFACTS_CHECK_REPORTED = 419;
1891  ATOM_VBMETA_DIGEST_REPORTED = 420;
1892  ATOM_APEX_INFO_GATHERED = 421;
1893  ATOM_PVM_INFO_GATHERED = 422;
1894  ATOM_WEAR_SETTINGS_UI_INTERACTED = 423;
1895  ATOM_TRACING_SERVICE_REPORT_EVENT = 424;
1896  ATOM_MEDIAMETRICS_AUDIORECORDSTATUS_REPORTED = 425;
1897  ATOM_LAUNCHER_LATENCY = 426;
1898  ATOM_DROPBOX_ENTRY_DROPPED = 427;
1899  ATOM_WIFI_P2P_CONNECTION_REPORTED = 428;
1900  ATOM_GAME_STATE_CHANGED = 429;
1901  ATOM_HOTWORD_DETECTOR_CREATE_REQUESTED = 430;
1902  ATOM_HOTWORD_DETECTION_SERVICE_INIT_RESULT_REPORTED = 431;
1903  ATOM_HOTWORD_DETECTION_SERVICE_RESTARTED = 432;
1904  ATOM_HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED = 433;
1905  ATOM_HOTWORD_DETECTOR_EVENTS = 434;
1906  ATOM_BOOT_COMPLETED_BROADCAST_COMPLETION_LATENCY_REPORTED = 437;
1907  ATOM_CONTACTS_INDEXER_UPDATE_STATS_REPORTED = 440;
1908  ATOM_APP_BACKGROUND_RESTRICTIONS_INFO = 441;
1909  ATOM_MMS_SMS_PROVIDER_GET_THREAD_ID_FAILED = 442;
1910  ATOM_MMS_SMS_DATABASE_HELPER_ON_UPGRADE_FAILED = 443;
1911  ATOM_PERMISSION_REMINDER_NOTIFICATION_INTERACTED = 444;
1912  ATOM_RECENT_PERMISSION_DECISIONS_INTERACTED = 445;
1913  ATOM_GNSS_PSDS_DOWNLOAD_REPORTED = 446;
1914  ATOM_LE_AUDIO_CONNECTION_SESSION_REPORTED = 447;
1915  ATOM_LE_AUDIO_BROADCAST_SESSION_REPORTED = 448;
1916  ATOM_DREAM_UI_EVENT_REPORTED = 449;
1917  ATOM_TASK_MANAGER_EVENT_REPORTED = 450;
1918  ATOM_CDM_ASSOCIATION_ACTION = 451;
1919  ATOM_MAGNIFICATION_TRIPLE_TAP_AND_HOLD_ACTIVATED_SESSION_REPORTED = 452;
1920  ATOM_MAGNIFICATION_FOLLOW_TYPING_FOCUS_ACTIVATED_SESSION_REPORTED = 453;
1921  ATOM_ACCESSIBILITY_TEXT_READING_OPTIONS_CHANGED = 454;
1922  ATOM_WIFI_SETUP_FAILURE_CRASH_REPORTED = 455;
1923  ATOM_UWB_DEVICE_ERROR_REPORTED = 456;
1924  ATOM_ISOLATED_COMPILATION_SCHEDULED = 457;
1925  ATOM_ISOLATED_COMPILATION_ENDED = 458;
1926  ATOM_ONS_OPPORTUNISTIC_ESIM_PROVISIONING_COMPLETE = 459;
1927  ATOM_TELEPHONY_ANOMALY_DETECTED = 461;
1928  ATOM_LETTERBOX_POSITION_CHANGED = 462;
1929  ATOM_REMOTE_KEY_PROVISIONING_ATTEMPT = 463;
1930  ATOM_REMOTE_KEY_PROVISIONING_NETWORK_INFO = 464;
1931  ATOM_REMOTE_KEY_PROVISIONING_TIMING = 465;
1932  ATOM_MEDIAOUTPUT_OP_INTERACTION_REPORT = 466;
1933  ATOM_BACKGROUND_DEXOPT_JOB_ENDED = 467;
1934  ATOM_SYNC_EXEMPTION_OCCURRED = 468;
1935  ATOM_AUTOFILL_PRESENTATION_EVENT_REPORTED = 469;
1936  ATOM_DOCK_STATE_CHANGED = 470;
1937  ATOM_BROADCAST_DELIVERY_EVENT_REPORTED = 475;
1938  ATOM_SERVICE_REQUEST_EVENT_REPORTED = 476;
1939  ATOM_PROVIDER_ACQUISITION_EVENT_REPORTED = 477;
1940  ATOM_BLUETOOTH_DEVICE_NAME_REPORTED = 478;
1941  ATOM_VIBRATION_REPORTED = 487;
1942  ATOM_UWB_RANGING_START = 489;
1943  ATOM_DISPLAY_BRIGHTNESS_CHANGED = 494;
1944  ATOM_ACTIVITY_ACTION_BLOCKED = 495;
1945  ATOM_NETWORK_DNS_SERVER_SUPPORT_REPORTED = 504;
1946  ATOM_VM_BOOTED = 505;
1947  ATOM_VM_EXITED = 506;
1948  ATOM_AMBIENT_BRIGHTNESS_STATS_REPORTED = 507;
1949  ATOM_MEDIAMETRICS_SPATIALIZERCAPABILITIES_REPORTED = 508;
1950  ATOM_MEDIAMETRICS_SPATIALIZERDEVICEENABLED_REPORTED = 509;
1951  ATOM_MEDIAMETRICS_HEADTRACKERDEVICEENABLED_REPORTED = 510;
1952  ATOM_MEDIAMETRICS_HEADTRACKERDEVICESUPPORTED_REPORTED = 511;
1953  ATOM_HEARING_AID_INFO_REPORTED = 513;
1954  ATOM_DEVICE_WIDE_JOB_CONSTRAINT_CHANGED = 514;
1955  ATOM_IWLAN_SETUP_DATA_CALL_RESULT_REPORTED = 519;
1956  ATOM_IWLAN_PDN_DISCONNECTED_REASON_REPORTED = 520;
1957  ATOM_AIRPLANE_MODE_SESSION_REPORTED = 521;
1958  ATOM_VM_CPU_STATUS_REPORTED = 522;
1959  ATOM_VM_MEM_STATUS_REPORTED = 523;
1960  ATOM_DEFAULT_NETWORK_REMATCH_INFO = 525;
1961  ATOM_NETWORK_SELECTION_PERFORMANCE = 526;
1962  ATOM_NETWORK_NSD_REPORTED = 527;
1963  ATOM_BLUETOOTH_DISCONNECTION_REASON_REPORTED = 529;
1964  ATOM_BLUETOOTH_LOCAL_VERSIONS_REPORTED = 530;
1965  ATOM_BLUETOOTH_REMOTE_SUPPORTED_FEATURES_REPORTED = 531;
1966  ATOM_BLUETOOTH_LOCAL_SUPPORTED_FEATURES_REPORTED = 532;
1967  ATOM_BLUETOOTH_GATT_APP_INFO = 533;
1968  ATOM_BRIGHTNESS_CONFIGURATION_UPDATED = 534;
1969  ATOM_LAUNCHER_IMPRESSION_EVENT = 547;
1970  ATOM_ODSIGN_REPORTED = 548;
1971  ATOM_ART_DEVICE_DATUM_REPORTED = 550;
1972  ATOM_NETWORK_SLICE_SESSION_ENDED = 558;
1973  ATOM_NETWORK_SLICE_DAILY_DATA_USAGE_REPORTED = 559;
1974  ATOM_NFC_TAG_TYPE_OCCURRED = 560;
1975  ATOM_NFC_AID_CONFLICT_OCCURRED = 561;
1976  ATOM_NFC_READER_CONFLICT_OCCURRED = 562;
1977  ATOM_ART_DATUM_DELTA_REPORTED = 565;
1978  ATOM_MEDIA_DRM_CREATED = 568;
1979  ATOM_MEDIA_DRM_ERRORED = 569;
1980  ATOM_MEDIA_DRM_SESSION_OPENED = 570;
1981  ATOM_MEDIA_DRM_SESSION_CLOSED = 571;
1982  ATOM_PERFORMANCE_HINT_SESSION_REPORTED = 574;
1983  ATOM_HOTWORD_AUDIO_EGRESS_EVENT_REPORTED = 578;
1984  ATOM_NETWORK_VALIDATION_FAILURE_STATS_DAILY_REPORTED = 601;
1985  ATOM_WIFI_BYTES_TRANSFER = 10000;
1986  ATOM_WIFI_BYTES_TRANSFER_BY_FG_BG = 10001;
1987  ATOM_MOBILE_BYTES_TRANSFER = 10002;
1988  ATOM_MOBILE_BYTES_TRANSFER_BY_FG_BG = 10003;
1989  ATOM_BLUETOOTH_BYTES_TRANSFER = 10006;
1990  ATOM_KERNEL_WAKELOCK = 10004;
1991  ATOM_SUBSYSTEM_SLEEP_STATE = 10005;
1992  ATOM_CPU_TIME_PER_UID = 10009;
1993  ATOM_CPU_TIME_PER_UID_FREQ = 10010;
1994  ATOM_WIFI_ACTIVITY_INFO = 10011;
1995  ATOM_MODEM_ACTIVITY_INFO = 10012;
1996  ATOM_BLUETOOTH_ACTIVITY_INFO = 10007;
1997  ATOM_PROCESS_MEMORY_STATE = 10013;
1998  ATOM_SYSTEM_ELAPSED_REALTIME = 10014;
1999  ATOM_SYSTEM_UPTIME = 10015;
2000  ATOM_CPU_ACTIVE_TIME = 10016;
2001  ATOM_CPU_CLUSTER_TIME = 10017;
2002  ATOM_DISK_SPACE = 10018;
2003  ATOM_REMAINING_BATTERY_CAPACITY = 10019;
2004  ATOM_FULL_BATTERY_CAPACITY = 10020;
2005  ATOM_TEMPERATURE = 10021;
2006  ATOM_BINDER_CALLS = 10022;
2007  ATOM_BINDER_CALLS_EXCEPTIONS = 10023;
2008  ATOM_LOOPER_STATS = 10024;
2009  ATOM_DISK_STATS = 10025;
2010  ATOM_DIRECTORY_USAGE = 10026;
2011  ATOM_APP_SIZE = 10027;
2012  ATOM_CATEGORY_SIZE = 10028;
2013  ATOM_PROC_STATS = 10029;
2014  ATOM_BATTERY_VOLTAGE = 10030;
2015  ATOM_NUM_FINGERPRINTS_ENROLLED = 10031;
2016  ATOM_DISK_IO = 10032;
2017  ATOM_POWER_PROFILE = 10033;
2018  ATOM_PROC_STATS_PKG_PROC = 10034;
2019  ATOM_PROCESS_CPU_TIME = 10035;
2020  ATOM_CPU_TIME_PER_THREAD_FREQ = 10037;
2021  ATOM_ON_DEVICE_POWER_MEASUREMENT = 10038;
2022  ATOM_DEVICE_CALCULATED_POWER_USE = 10039;
2023  ATOM_PROCESS_MEMORY_HIGH_WATER_MARK = 10042;
2024  ATOM_BATTERY_LEVEL = 10043;
2025  ATOM_BUILD_INFORMATION = 10044;
2026  ATOM_BATTERY_CYCLE_COUNT = 10045;
2027  ATOM_DEBUG_ELAPSED_CLOCK = 10046;
2028  ATOM_DEBUG_FAILING_ELAPSED_CLOCK = 10047;
2029  ATOM_NUM_FACES_ENROLLED = 10048;
2030  ATOM_ROLE_HOLDER = 10049;
2031  ATOM_DANGEROUS_PERMISSION_STATE = 10050;
2032  ATOM_TRAIN_INFO = 10051;
2033  ATOM_TIME_ZONE_DATA_INFO = 10052;
2034  ATOM_EXTERNAL_STORAGE_INFO = 10053;
2035  ATOM_GPU_STATS_GLOBAL_INFO = 10054;
2036  ATOM_GPU_STATS_APP_INFO = 10055;
2037  ATOM_SYSTEM_ION_HEAP_SIZE = 10056;
2038  ATOM_APPS_ON_EXTERNAL_STORAGE_INFO = 10057;
2039  ATOM_FACE_SETTINGS = 10058;
2040  ATOM_COOLING_DEVICE = 10059;
2041  ATOM_APP_OPS = 10060;
2042  ATOM_PROCESS_SYSTEM_ION_HEAP_SIZE = 10061;
2043  ATOM_SURFACEFLINGER_STATS_GLOBAL_INFO = 10062;
2044  ATOM_SURFACEFLINGER_STATS_LAYER_INFO = 10063;
2045  ATOM_PROCESS_MEMORY_SNAPSHOT = 10064;
2046  ATOM_VMS_CLIENT_STATS = 10065;
2047  ATOM_NOTIFICATION_REMOTE_VIEWS = 10066;
2048  ATOM_DANGEROUS_PERMISSION_STATE_SAMPLED = 10067;
2049  ATOM_GRAPHICS_STATS = 10068;
2050  ATOM_RUNTIME_APP_OP_ACCESS = 10069;
2051  ATOM_ION_HEAP_SIZE = 10070;
2052  ATOM_PACKAGE_NOTIFICATION_PREFERENCES = 10071;
2053  ATOM_PACKAGE_NOTIFICATION_CHANNEL_PREFERENCES = 10072;
2054  ATOM_PACKAGE_NOTIFICATION_CHANNEL_GROUP_PREFERENCES = 10073;
2055  ATOM_GNSS_STATS = 10074;
2056  ATOM_ATTRIBUTED_APP_OPS = 10075;
2057  ATOM_VOICE_CALL_SESSION = 10076;
2058  ATOM_VOICE_CALL_RAT_USAGE = 10077;
2059  ATOM_SIM_SLOT_STATE = 10078;
2060  ATOM_SUPPORTED_RADIO_ACCESS_FAMILY = 10079;
2061  ATOM_SETTING_SNAPSHOT = 10080;
2062  ATOM_BLOB_INFO = 10081;
2063  ATOM_DATA_USAGE_BYTES_TRANSFER = 10082;
2064  ATOM_BYTES_TRANSFER_BY_TAG_AND_METERED = 10083;
2065  ATOM_DND_MODE_RULE = 10084;
2066  ATOM_GENERAL_EXTERNAL_STORAGE_ACCESS_STATS = 10085;
2067  ATOM_INCOMING_SMS = 10086;
2068  ATOM_OUTGOING_SMS = 10087;
2069  ATOM_CARRIER_ID_TABLE_VERSION = 10088;
2070  ATOM_DATA_CALL_SESSION = 10089;
2071  ATOM_CELLULAR_SERVICE_STATE = 10090;
2072  ATOM_CELLULAR_DATA_SERVICE_SWITCH = 10091;
2073  ATOM_SYSTEM_MEMORY = 10092;
2074  ATOM_IMS_REGISTRATION_TERMINATION = 10093;
2075  ATOM_IMS_REGISTRATION_STATS = 10094;
2076  ATOM_CPU_TIME_PER_CLUSTER_FREQ = 10095;
2077  ATOM_CPU_CYCLES_PER_UID_CLUSTER = 10096;
2078  ATOM_DEVICE_ROTATED_DATA = 10097;
2079  ATOM_CPU_CYCLES_PER_THREAD_GROUP_CLUSTER = 10098;
2080  ATOM_MEDIA_DRM_ACTIVITY_INFO = 10099;
2081  ATOM_OEM_MANAGED_BYTES_TRANSFER = 10100;
2082  ATOM_GNSS_POWER_STATS = 10101;
2083  ATOM_TIME_ZONE_DETECTOR_STATE = 10102;
2084  ATOM_KEYSTORE2_STORAGE_STATS = 10103;
2085  ATOM_RKP_POOL_STATS = 10104;
2086  ATOM_PROCESS_DMABUF_MEMORY = 10105;
2087  ATOM_PENDING_ALARM_INFO = 10106;
2088  ATOM_USER_LEVEL_HIBERNATED_APPS = 10107;
2089  ATOM_LAUNCHER_LAYOUT_SNAPSHOT = 10108;
2090  ATOM_GLOBAL_HIBERNATED_APPS = 10109;
2091  ATOM_INPUT_EVENT_LATENCY_SKETCH = 10110;
2092  ATOM_BATTERY_USAGE_STATS_BEFORE_RESET = 10111;
2093  ATOM_BATTERY_USAGE_STATS_SINCE_RESET = 10112;
2094  ATOM_BATTERY_USAGE_STATS_SINCE_RESET_USING_POWER_PROFILE_MODEL = 10113;
2095  ATOM_INSTALLED_INCREMENTAL_PACKAGE = 10114;
2096  ATOM_TELEPHONY_NETWORK_REQUESTS = 10115;
2097  ATOM_APP_SEARCH_STORAGE_INFO = 10116;
2098  ATOM_VMSTAT = 10117;
2099  ATOM_KEYSTORE2_KEY_CREATION_WITH_GENERAL_INFO = 10118;
2100  ATOM_KEYSTORE2_KEY_CREATION_WITH_AUTH_INFO = 10119;
2101  ATOM_KEYSTORE2_KEY_CREATION_WITH_PURPOSE_AND_MODES_INFO = 10120;
2102  ATOM_KEYSTORE2_ATOM_WITH_OVERFLOW = 10121;
2103  ATOM_KEYSTORE2_KEY_OPERATION_WITH_PURPOSE_AND_MODES_INFO = 10122;
2104  ATOM_KEYSTORE2_KEY_OPERATION_WITH_GENERAL_INFO = 10123;
2105  ATOM_RKP_ERROR_STATS = 10124;
2106  ATOM_KEYSTORE2_CRASH_STATS = 10125;
2107  ATOM_VENDOR_APEX_INFO = 10126;
2108  ATOM_ACCESSIBILITY_SHORTCUT_STATS = 10127;
2109  ATOM_ACCESSIBILITY_FLOATING_MENU_STATS = 10128;
2110  ATOM_DATA_USAGE_BYTES_TRANSFER_V2 = 10129;
2111  ATOM_MEDIA_CAPABILITIES = 10130;
2112  ATOM_CAR_WATCHDOG_SYSTEM_IO_USAGE_SUMMARY = 10131;
2113  ATOM_CAR_WATCHDOG_UID_IO_USAGE_SUMMARY = 10132;
2114  ATOM_IMS_REGISTRATION_FEATURE_TAG_STATS = 10133;
2115  ATOM_RCS_CLIENT_PROVISIONING_STATS = 10134;
2116  ATOM_RCS_ACS_PROVISIONING_STATS = 10135;
2117  ATOM_SIP_DELEGATE_STATS = 10136;
2118  ATOM_SIP_TRANSPORT_FEATURE_TAG_STATS = 10137;
2119  ATOM_SIP_MESSAGE_RESPONSE = 10138;
2120  ATOM_SIP_TRANSPORT_SESSION = 10139;
2121  ATOM_IMS_DEDICATED_BEARER_LISTENER_EVENT = 10140;
2122  ATOM_IMS_DEDICATED_BEARER_EVENT = 10141;
2123  ATOM_IMS_REGISTRATION_SERVICE_DESC_STATS = 10142;
2124  ATOM_UCE_EVENT_STATS = 10143;
2125  ATOM_PRESENCE_NOTIFY_EVENT = 10144;
2126  ATOM_GBA_EVENT = 10145;
2127  ATOM_PER_SIM_STATUS = 10146;
2128  ATOM_GPU_WORK_PER_UID = 10147;
2129  ATOM_PERSISTENT_URI_PERMISSIONS_AMOUNT_PER_PACKAGE = 10148;
2130  ATOM_SIGNED_PARTITION_INFO = 10149;
2131  ATOM_PINNED_FILE_SIZES_PER_PACKAGE = 10150;
2132  ATOM_PENDING_INTENTS_PER_PACKAGE = 10151;
2133  ATOM_USER_INFO = 10152;
2134  ATOM_TELEPHONY_NETWORK_REQUESTS_V2 = 10153;
2135  ATOM_DEVICE_TELEPHONY_PROPERTIES = 10154;
2136  ATOM_REMOTE_KEY_PROVISIONING_ERROR_COUNTS = 10155;
2137  ATOM_INCOMING_MMS = 10157;
2138  ATOM_OUTGOING_MMS = 10158;
2139  ATOM_MULTI_USER_INFO = 10160;
2140  ATOM_NETWORK_BPF_MAP_INFO = 10161;
2141  ATOM_CONNECTIVITY_STATE_SAMPLE = 10163;
2142  ATOM_NETWORK_SELECTION_REMATCH_REASONS_INFO = 10164;
2143  ATOM_NETWORK_SLICE_REQUEST_COUNT = 10168;
2144  ATOM_ADPF_SYSTEM_COMPONENT_INFO = 10173;
2145  ATOM_NOTIFICATION_MEMORY_USE = 10174;
2146}
2147// End of protos/perfetto/config/statsd/atom_ids.proto
2148
2149// Begin of protos/perfetto/config/statsd/statsd_tracing_config.proto
2150
2151// This file is named 'statsd_tracing_config.proto' rather than
2152// 'statsd_config.proto' (which would be more consistent with the other
2153// config protos) so it doesn't show up and confuse folks looking for
2154// the existing statsd_config.proto for configuring statsd itself.
2155// Same for the config proto itself.
2156message StatsdTracingConfig {
2157  // This is for the common case of the atom id being known in the enum AtomId.
2158  repeated AtomId push_atom_id = 1;
2159
2160  // Escape hatch for Atom IDs that are not yet in the AtomId enum
2161  // (e.g. non-upstream atoms that don't exist in AOSP).
2162  repeated int32 raw_push_atom_id = 2;
2163  repeated StatsdPullAtomConfig pull_config = 3;
2164}
2165
2166message StatsdPullAtomConfig {
2167  repeated AtomId pull_atom_id = 1;
2168  repeated int32 raw_pull_atom_id = 2;
2169
2170  optional int32 pull_frequency_ms = 3;
2171  repeated string packages = 4;
2172}
2173
2174// End of protos/perfetto/config/statsd/statsd_tracing_config.proto
2175
2176// Begin of protos/perfetto/common/sys_stats_counters.proto
2177
2178// When editing entries here remember also to update "sys_stats_counters.h" with
2179// the corresponding string definitions for the actual /proc files parser.
2180
2181// Counter definitions for Linux's /proc/meminfo.
2182enum MeminfoCounters {
2183  MEMINFO_UNSPECIFIED = 0;
2184  MEMINFO_MEM_TOTAL = 1;
2185  MEMINFO_MEM_FREE = 2;
2186  MEMINFO_MEM_AVAILABLE = 3;
2187  MEMINFO_BUFFERS = 4;
2188  MEMINFO_CACHED = 5;
2189  MEMINFO_SWAP_CACHED = 6;
2190  MEMINFO_ACTIVE = 7;
2191  MEMINFO_INACTIVE = 8;
2192  MEMINFO_ACTIVE_ANON = 9;
2193  MEMINFO_INACTIVE_ANON = 10;
2194  MEMINFO_ACTIVE_FILE = 11;
2195  MEMINFO_INACTIVE_FILE = 12;
2196  MEMINFO_UNEVICTABLE = 13;
2197  MEMINFO_MLOCKED = 14;
2198  MEMINFO_SWAP_TOTAL = 15;
2199  MEMINFO_SWAP_FREE = 16;
2200  MEMINFO_DIRTY = 17;
2201  MEMINFO_WRITEBACK = 18;
2202  MEMINFO_ANON_PAGES = 19;
2203  MEMINFO_MAPPED = 20;
2204  MEMINFO_SHMEM = 21;
2205  MEMINFO_SLAB = 22;
2206  MEMINFO_SLAB_RECLAIMABLE = 23;
2207  MEMINFO_SLAB_UNRECLAIMABLE = 24;
2208  MEMINFO_KERNEL_STACK = 25;
2209  MEMINFO_PAGE_TABLES = 26;
2210  MEMINFO_COMMIT_LIMIT = 27;
2211  MEMINFO_COMMITED_AS = 28;
2212  MEMINFO_VMALLOC_TOTAL = 29;
2213  MEMINFO_VMALLOC_USED = 30;
2214  MEMINFO_VMALLOC_CHUNK = 31;
2215  MEMINFO_CMA_TOTAL = 32;
2216  MEMINFO_CMA_FREE = 33;
2217}
2218
2219// Counter definitions for Linux's /proc/vmstat.
2220enum VmstatCounters {
2221  VMSTAT_UNSPECIFIED = 0;
2222  VMSTAT_NR_FREE_PAGES = 1;
2223  VMSTAT_NR_ALLOC_BATCH = 2;
2224  VMSTAT_NR_INACTIVE_ANON = 3;
2225  VMSTAT_NR_ACTIVE_ANON = 4;
2226  VMSTAT_NR_INACTIVE_FILE = 5;
2227  VMSTAT_NR_ACTIVE_FILE = 6;
2228  VMSTAT_NR_UNEVICTABLE = 7;
2229  VMSTAT_NR_MLOCK = 8;
2230  VMSTAT_NR_ANON_PAGES = 9;
2231  VMSTAT_NR_MAPPED = 10;
2232  VMSTAT_NR_FILE_PAGES = 11;
2233  VMSTAT_NR_DIRTY = 12;
2234  VMSTAT_NR_WRITEBACK = 13;
2235  VMSTAT_NR_SLAB_RECLAIMABLE = 14;
2236  VMSTAT_NR_SLAB_UNRECLAIMABLE = 15;
2237  VMSTAT_NR_PAGE_TABLE_PAGES = 16;
2238  VMSTAT_NR_KERNEL_STACK = 17;
2239  VMSTAT_NR_OVERHEAD = 18;
2240  VMSTAT_NR_UNSTABLE = 19;
2241  VMSTAT_NR_BOUNCE = 20;
2242  VMSTAT_NR_VMSCAN_WRITE = 21;
2243  VMSTAT_NR_VMSCAN_IMMEDIATE_RECLAIM = 22;
2244  VMSTAT_NR_WRITEBACK_TEMP = 23;
2245  VMSTAT_NR_ISOLATED_ANON = 24;
2246  VMSTAT_NR_ISOLATED_FILE = 25;
2247  VMSTAT_NR_SHMEM = 26;
2248  VMSTAT_NR_DIRTIED = 27;
2249  VMSTAT_NR_WRITTEN = 28;
2250  VMSTAT_NR_PAGES_SCANNED = 29;
2251  VMSTAT_WORKINGSET_REFAULT = 30;
2252  VMSTAT_WORKINGSET_ACTIVATE = 31;
2253  VMSTAT_WORKINGSET_NODERECLAIM = 32;
2254  VMSTAT_NR_ANON_TRANSPARENT_HUGEPAGES = 33;
2255  VMSTAT_NR_FREE_CMA = 34;
2256  VMSTAT_NR_SWAPCACHE = 35;
2257  VMSTAT_NR_DIRTY_THRESHOLD = 36;
2258  VMSTAT_NR_DIRTY_BACKGROUND_THRESHOLD = 37;
2259  VMSTAT_PGPGIN = 38;
2260  VMSTAT_PGPGOUT = 39;
2261  VMSTAT_PGPGOUTCLEAN = 40;
2262  VMSTAT_PSWPIN = 41;
2263  VMSTAT_PSWPOUT = 42;
2264  VMSTAT_PGALLOC_DMA = 43;
2265  VMSTAT_PGALLOC_NORMAL = 44;
2266  VMSTAT_PGALLOC_MOVABLE = 45;
2267  VMSTAT_PGFREE = 46;
2268  VMSTAT_PGACTIVATE = 47;
2269  VMSTAT_PGDEACTIVATE = 48;
2270  VMSTAT_PGFAULT = 49;
2271  VMSTAT_PGMAJFAULT = 50;
2272  VMSTAT_PGREFILL_DMA = 51;
2273  VMSTAT_PGREFILL_NORMAL = 52;
2274  VMSTAT_PGREFILL_MOVABLE = 53;
2275  VMSTAT_PGSTEAL_KSWAPD_DMA = 54;
2276  VMSTAT_PGSTEAL_KSWAPD_NORMAL = 55;
2277  VMSTAT_PGSTEAL_KSWAPD_MOVABLE = 56;
2278  VMSTAT_PGSTEAL_DIRECT_DMA = 57;
2279  VMSTAT_PGSTEAL_DIRECT_NORMAL = 58;
2280  VMSTAT_PGSTEAL_DIRECT_MOVABLE = 59;
2281  VMSTAT_PGSCAN_KSWAPD_DMA = 60;
2282  VMSTAT_PGSCAN_KSWAPD_NORMAL = 61;
2283  VMSTAT_PGSCAN_KSWAPD_MOVABLE = 62;
2284  VMSTAT_PGSCAN_DIRECT_DMA = 63;
2285  VMSTAT_PGSCAN_DIRECT_NORMAL = 64;
2286  VMSTAT_PGSCAN_DIRECT_MOVABLE = 65;
2287  VMSTAT_PGSCAN_DIRECT_THROTTLE = 66;
2288  VMSTAT_PGINODESTEAL = 67;
2289  VMSTAT_SLABS_SCANNED = 68;
2290  VMSTAT_KSWAPD_INODESTEAL = 69;
2291  VMSTAT_KSWAPD_LOW_WMARK_HIT_QUICKLY = 70;
2292  VMSTAT_KSWAPD_HIGH_WMARK_HIT_QUICKLY = 71;
2293  VMSTAT_PAGEOUTRUN = 72;
2294  VMSTAT_ALLOCSTALL = 73;
2295  VMSTAT_PGROTATED = 74;
2296  VMSTAT_DROP_PAGECACHE = 75;
2297  VMSTAT_DROP_SLAB = 76;
2298  VMSTAT_PGMIGRATE_SUCCESS = 77;
2299  VMSTAT_PGMIGRATE_FAIL = 78;
2300  VMSTAT_COMPACT_MIGRATE_SCANNED = 79;
2301  VMSTAT_COMPACT_FREE_SCANNED = 80;
2302  VMSTAT_COMPACT_ISOLATED = 81;
2303  VMSTAT_COMPACT_STALL = 82;
2304  VMSTAT_COMPACT_FAIL = 83;
2305  VMSTAT_COMPACT_SUCCESS = 84;
2306  VMSTAT_COMPACT_DAEMON_WAKE = 85;
2307  VMSTAT_UNEVICTABLE_PGS_CULLED = 86;
2308  VMSTAT_UNEVICTABLE_PGS_SCANNED = 87;
2309  VMSTAT_UNEVICTABLE_PGS_RESCUED = 88;
2310  VMSTAT_UNEVICTABLE_PGS_MLOCKED = 89;
2311  VMSTAT_UNEVICTABLE_PGS_MUNLOCKED = 90;
2312  VMSTAT_UNEVICTABLE_PGS_CLEARED = 91;
2313  VMSTAT_UNEVICTABLE_PGS_STRANDED = 92;
2314  VMSTAT_NR_ZSPAGES = 93;
2315  VMSTAT_NR_ION_HEAP = 94;
2316  VMSTAT_NR_GPU_HEAP = 95;
2317  VMSTAT_ALLOCSTALL_DMA = 96;
2318  VMSTAT_ALLOCSTALL_MOVABLE = 97;
2319  VMSTAT_ALLOCSTALL_NORMAL = 98;
2320  VMSTAT_COMPACT_DAEMON_FREE_SCANNED = 99;
2321  VMSTAT_COMPACT_DAEMON_MIGRATE_SCANNED = 100;
2322  VMSTAT_NR_FASTRPC = 101;
2323  VMSTAT_NR_INDIRECTLY_RECLAIMABLE = 102;
2324  VMSTAT_NR_ION_HEAP_POOL = 103;
2325  VMSTAT_NR_KERNEL_MISC_RECLAIMABLE = 104;
2326  VMSTAT_NR_SHADOW_CALL_STACK_BYTES = 105;
2327  VMSTAT_NR_SHMEM_HUGEPAGES = 106;
2328  VMSTAT_NR_SHMEM_PMDMAPPED = 107;
2329  VMSTAT_NR_UNRECLAIMABLE_PAGES = 108;
2330  VMSTAT_NR_ZONE_ACTIVE_ANON = 109;
2331  VMSTAT_NR_ZONE_ACTIVE_FILE = 110;
2332  VMSTAT_NR_ZONE_INACTIVE_ANON = 111;
2333  VMSTAT_NR_ZONE_INACTIVE_FILE = 112;
2334  VMSTAT_NR_ZONE_UNEVICTABLE = 113;
2335  VMSTAT_NR_ZONE_WRITE_PENDING = 114;
2336  VMSTAT_OOM_KILL = 115;
2337  VMSTAT_PGLAZYFREE = 116;
2338  VMSTAT_PGLAZYFREED = 117;
2339  VMSTAT_PGREFILL = 118;
2340  VMSTAT_PGSCAN_DIRECT = 119;
2341  VMSTAT_PGSCAN_KSWAPD = 120;
2342  VMSTAT_PGSKIP_DMA = 121;
2343  VMSTAT_PGSKIP_MOVABLE = 122;
2344  VMSTAT_PGSKIP_NORMAL = 123;
2345  VMSTAT_PGSTEAL_DIRECT = 124;
2346  VMSTAT_PGSTEAL_KSWAPD = 125;
2347  VMSTAT_SWAP_RA = 126;
2348  VMSTAT_SWAP_RA_HIT = 127;
2349  VMSTAT_WORKINGSET_RESTORE = 128;
2350}
2351// End of protos/perfetto/common/sys_stats_counters.proto
2352
2353// Begin of protos/perfetto/config/sys_stats/sys_stats_config.proto
2354
2355// This file defines the configuration for the Linux /proc poller data source,
2356// which injects counters in the trace.
2357// Counters that are needed in the trace must be explicitly listed in the
2358// *_counters fields. This is to avoid spamming the trace with all counters
2359// at all times.
2360// The sampling rate is configurable. All polling rates (*_period_ms) need
2361// to be integer multiples of each other.
2362// OK:     [10ms, 10ms, 10ms],  [10ms, 20ms, 10ms],  [10ms, 20ms, 60ms]
2363// Not OK: [10ms, 10ms, 11ms],  [10ms, 15ms, 20ms]
2364message SysStatsConfig {
2365  // Polls /proc/meminfo every X ms, if non-zero.
2366  // This is required to be > 10ms to avoid excessive CPU usage.
2367  // Cost: 0.3 ms [read] + 0.07 ms [parse + trace injection]
2368  optional uint32 meminfo_period_ms = 1;
2369
2370  // If empty all known counters are reported. Otherwise, only the counters
2371  // specified below are reported.
2372  repeated MeminfoCounters meminfo_counters = 2;
2373
2374  // Polls /proc/vmstat every X ms, if non-zero.
2375  // This is required to be > 10ms to avoid excessive CPU usage.
2376  // Cost: 0.2 ms [read] + 0.3 ms [parse + trace injection]
2377  optional uint32 vmstat_period_ms = 3;
2378  repeated VmstatCounters vmstat_counters = 4;
2379
2380  // Pols /proc/stat every X ms, if non-zero.
2381  // This is required to be > 10ms to avoid excessive CPU usage.
2382  // Cost: 4.1 ms [read] + 1.9 ms [parse + trace injection]
2383  optional uint32 stat_period_ms = 5;
2384  enum StatCounters {
2385    STAT_UNSPECIFIED = 0;
2386    STAT_CPU_TIMES = 1;
2387    STAT_IRQ_COUNTS = 2;
2388    STAT_SOFTIRQ_COUNTS = 3;
2389    STAT_FORK_COUNT = 4;
2390  }
2391  repeated StatCounters stat_counters = 6;
2392
2393  // Polls /sys/devfreq/*/curfreq every X ms, if non-zero.
2394  // This is required to be > 10ms to avoid excessive CPU usage.
2395  // This option can be used to record unchanging values.
2396  // Updates from frequency changes can come from ftrace/set_clock_rate.
2397  optional uint32 devfreq_period_ms = 7;
2398
2399  // Polls /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq every X ms.
2400  // This is required to be > 10ms to avoid excessive CPU usage.
2401  optional uint32 cpufreq_period_ms = 8;
2402
2403  // Polls /proc/buddyinfo every X ms, if non-zero.
2404  // This is required to be > 10ms to avoid excessive CPU usage.
2405  optional uint32 buddyinfo_period_ms = 9;
2406
2407  // Polls /proc/diskstats every X ms, if non-zero.
2408  // This is required to be > 10ms to avoid excessive CPU usage.
2409  optional uint32 diskstat_period_ms = 10;
2410}
2411
2412// End of protos/perfetto/config/sys_stats/sys_stats_config.proto
2413
2414// Begin of protos/perfetto/config/system_info/system_info.proto
2415
2416// This data-source does a one-off recording of system information when
2417// the trace starts.
2418// Currently this includes:
2419// - Values of
2420// /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies This
2421// datasource has no configuration options at present.
2422message SystemInfoConfig {}
2423
2424// End of protos/perfetto/config/system_info/system_info.proto
2425
2426// Begin of protos/perfetto/config/test_config.proto
2427
2428// The configuration for a fake producer used in tests.
2429message TestConfig {
2430  message DummyFields {
2431    optional uint32 field_uint32 = 1;
2432    optional int32 field_int32 = 2;
2433    optional uint64 field_uint64 = 3;
2434    optional int64 field_int64 = 4;
2435    optional fixed64 field_fixed64 = 5;
2436    optional sfixed64 field_sfixed64 = 6;
2437    optional fixed32 field_fixed32 = 7;
2438    optional sfixed32 field_sfixed32 = 8;
2439    optional double field_double = 9;
2440    optional float field_float = 10;
2441    optional sint64 field_sint64 = 11;
2442    optional sint32 field_sint32 = 12;
2443    optional string field_string = 13;
2444    optional bytes field_bytes = 14;
2445  }
2446
2447  // The number of messages the fake producer should send.
2448  optional uint32 message_count = 1;
2449
2450  // The maximum number of messages which should be sent each second.
2451  // The actual obserced speed may be lower if the producer is unable to
2452  // work fast enough.
2453  // If this is zero or unset, the producer will send as fast as possible.
2454  optional uint32 max_messages_per_second = 2;
2455
2456  // The seed value for a simple multiplicative congruential pseudo-random
2457  // number sequence.
2458  optional uint32 seed = 3;
2459
2460  // The size of each message in bytes. Should be greater than or equal 5 to
2461  // account for the number of bytes needed to encode the random number and a
2462  // null byte for the string.
2463  optional uint32 message_size = 4;
2464
2465  // Whether the producer should send a event batch when the data source is
2466  // is initially registered.
2467  optional bool send_batch_on_register = 5;
2468
2469  optional DummyFields dummy_fields = 6;
2470}
2471
2472// End of protos/perfetto/config/test_config.proto
2473
2474// Begin of protos/perfetto/config/track_event/track_event_config.proto
2475
2476message TrackEventConfig {
2477  // The following fields define the set of enabled trace categories. Each list
2478  // item is a glob.
2479  //
2480  // To determine if category is enabled, it is checked against the filters in
2481  // the following order:
2482  //
2483  //   1. Exact matches in enabled categories.
2484  //   2. Exact matches in enabled tags.
2485  //   3. Exact matches in disabled categories.
2486  //   4. Exact matches in disabled tags.
2487  //   5. Pattern matches in enabled categories.
2488  //   6. Pattern matches in enabled tags.
2489  //   7. Pattern matches in disabled categories.
2490  //   8. Pattern matches in disabled tags.
2491  //
2492  // If none of the steps produced a match, the category is enabled by default.
2493  //
2494  // Examples:
2495  //
2496  //  - To enable all non-slow/debug categories:
2497  //
2498  //       No configuration needed, happens by default.
2499  //
2500  //  - To enable a specific category:
2501  //
2502  //       disabled_categories = ["*"]
2503  //       enabled_categories = ["my_category"]
2504  //
2505  //  - To enable only categories with a specific tag:
2506  //
2507  //       disabled_tags = ["*"]
2508  //       enabled_tags = ["my_tag"]
2509  //
2510
2511  // Default: []
2512  repeated string disabled_categories = 1;
2513
2514  // Default: []
2515  repeated string enabled_categories = 2;
2516
2517  // Default: ["slow", "debug"]
2518  repeated string disabled_tags = 3;
2519
2520  // Default: []
2521  repeated string enabled_tags = 4;
2522
2523  // Default: false (i.e. enabled by default)
2524  optional bool disable_incremental_timestamps = 5;
2525
2526  // Allows to specify a custom unit different than the default (ns).
2527  // Also affects thread timestamps if enable_thread_time_sampling = true.
2528  // A multiplier of 1000 means that a timestamp = 3 should be interpreted as
2529  // 3000 ns = 3 us.
2530  // Default: 1 (if unset, it should be read as 1).
2531  optional uint64 timestamp_unit_multiplier = 6;
2532
2533  // Default: false (i.e. debug_annotations is NOT filtered out by default)
2534  // When true, any debug annotations provided as arguments to the
2535  // TRACE_EVENT macros are not written into the trace. Typed arguments will
2536  // still be emitted even if set to true.
2537  optional bool filter_debug_annotations = 7;
2538
2539  // Default : false (i.e. disabled)
2540  // When true, the SDK samples and emits the current thread time counter value
2541  // for each event on the current thread's track. This value represents the
2542  // total CPU time consumed by that thread since its creation. Note that if a
2543  // thread is not scheduled by OS for some duration, that time won't be
2544  // included in thread_time.
2545  // Learn more : "CLOCK_THREAD_CPUTIME_ID" flag at
2546  // https://linux.die.net/man/3/clock_gettime
2547  optional bool enable_thread_time_sampling = 8;
2548
2549  // Default: false (i.e. dynamic event names are NOT filtered out by default)
2550  // When true, event_names wrapped in perfetto::DynamicString will be filtered
2551  // out.
2552  optional bool filter_dynamic_event_names = 9;
2553}
2554
2555// End of protos/perfetto/config/track_event/track_event_config.proto
2556
2557// Begin of protos/perfetto/config/data_source_config.proto
2558
2559// The configuration that is passed to each data source when starting tracing.
2560// Next id: 123
2561message DataSourceConfig {
2562  enum SessionInitiator {
2563    SESSION_INITIATOR_UNSPECIFIED = 0;
2564    // This trace was initiated from a trusted system app has DUMP and
2565    // USAGE_STATS permission. This system app is expected to not expose the
2566    // trace to the user of the device.
2567    // This is determined by checking the UID initiating the trace.
2568    SESSION_INITIATOR_TRUSTED_SYSTEM = 1;
2569  };
2570  // Data source unique name, e.g., "linux.ftrace". This must match
2571  // the name passed by the data source when it registers (see
2572  // RegisterDataSource()).
2573  optional string name = 1;
2574
2575  // The index of the logging buffer where TracePacket(s) will be stored.
2576  // This field doesn't make a major difference for the Producer(s). The final
2577  // logging buffers, in fact, are completely owned by the Service. We just ask
2578  // the Producer to copy this number into the chunk headers it emits, so that
2579  // the Service can quickly identify the buffer where to move the chunks into
2580  // without expensive lookups on its fastpath.
2581  optional uint32 target_buffer = 2;
2582
2583  // Set by the service to indicate the duration of the trace.
2584  // DO NOT SET in consumer as this will be overridden by the service.
2585  optional uint32 trace_duration_ms = 3;
2586
2587  // If true, |trace_duration_ms| should count also time in suspend. This
2588  // is propagated from TraceConfig.prefer_suspend_clock_for_duration.
2589  optional bool prefer_suspend_clock_for_duration = 122;
2590
2591  // Set by the service to indicate how long it waits after StopDataSource.
2592  // DO NOT SET in consumer as this will be overridden by the service.
2593  optional uint32 stop_timeout_ms = 7;
2594
2595  // Set by the service to indicate whether this tracing session has extra
2596  // guardrails.
2597  // DO NOT SET in consumer as this will be overridden by the service.
2598  optional bool enable_extra_guardrails = 6;
2599
2600  // Set by the service to indicate which user initiated this trace.
2601  // DO NOT SET in consumer as this will be overridden by the service.
2602  optional SessionInitiator session_initiator = 8;
2603
2604  // Set by the service to indicate which tracing session the data source
2605  // belongs to. The intended use case for this is checking if two data sources,
2606  // one of which produces metadata for the other one, belong to the same trace
2607  // session and hence should be linked together.
2608  // This field was introduced in Aug 2018 after Android P.
2609  // DO NOT SET in consumer as this will be overridden by the service.
2610  optional uint64 tracing_session_id = 4;
2611
2612  // Keeep the lower IDs (up to 99) for fields that are *not* specific to
2613  // data-sources and needs to be processed by the traced daemon.
2614
2615  // All data source config fields must be marked as [lazy=true]. This prevents
2616  // the proto-to-cpp generator from recursing into those when generating the
2617  // cpp classes and polluting tracing/core with data-source-specific classes.
2618  // Instead they are treated as opaque strings containing raw proto bytes.
2619
2620  // Data source name: linux.ftrace
2621  optional FtraceConfig ftrace_config = 100 [lazy = true];
2622  // Data source name: linux.inode_file_map
2623  optional InodeFileConfig inode_file_config = 102 [lazy = true];
2624  // Data source name: linux.process_stats
2625  optional ProcessStatsConfig process_stats_config = 103 [lazy = true];
2626  // Data source name: linux.sys_stats
2627  optional SysStatsConfig sys_stats_config = 104 [lazy = true];
2628  // Data source name: android.heapprofd
2629  // Introduced in Android 10.
2630  optional HeapprofdConfig heapprofd_config = 105 [lazy = true];
2631  // Data source name: android.java_hprof
2632  // Introduced in Android 11.
2633  optional JavaHprofConfig java_hprof_config = 110 [lazy = true];
2634  // Data source name: android.power
2635  optional AndroidPowerConfig android_power_config = 106 [lazy = true];
2636  // Data source name: android.log
2637  optional AndroidLogConfig android_log_config = 107 [lazy = true];
2638  // TODO(fmayer): Add data source name for this.
2639  optional GpuCounterConfig gpu_counter_config = 108 [lazy = true];
2640  // Data source name: android.game_interventions
2641  optional AndroidGameInterventionListConfig
2642      android_game_intervention_list_config = 116 [lazy = true];
2643  // Data source name: android.packages_list
2644  optional PackagesListConfig packages_list_config = 109 [lazy = true];
2645  // Data source name: linux.perf
2646  optional PerfEventConfig perf_event_config = 111 [lazy = true];
2647  // Data source name: vulkan.memory_tracker
2648  optional VulkanMemoryConfig vulkan_memory_config = 112 [lazy = true];
2649  // Data source name: track_event
2650  optional TrackEventConfig track_event_config = 113 [lazy = true];
2651  // Data source name: android.polled_state
2652  optional AndroidPolledStateConfig android_polled_state_config = 114
2653      [lazy = true];
2654  // Data source name: android.system_property
2655  optional AndroidSystemPropertyConfig android_system_property_config = 118
2656      [lazy = true];
2657  // Data source name: android.statsd
2658  optional StatsdTracingConfig statsd_tracing_config = 117 [lazy = true];
2659  // Data source name: linux.system_info
2660  optional SystemInfoConfig system_info_config = 119;
2661
2662  // Chrome is special as it doesn't use the perfetto IPC layer. We want to
2663  // avoid proto serialization and de-serialization there because that would
2664  // just add extra hops on top of the Mojo ser/des. Instead we auto-generate a
2665  // C++ class for it so it can pass around plain C++ objets.
2666  optional ChromeConfig chrome_config = 101;
2667
2668  // If an interceptor is specified here, packets for this data source will be
2669  // rerouted to the interceptor instead of the main trace buffer. This can be
2670  // used, for example, to write trace data into ETW or for logging trace points
2671  // to the console.
2672  //
2673  // Note that interceptors are only supported by data sources registered
2674  // through the Perfetto SDK API. Data sources that don't use that API (e.g.,
2675  // traced_probes) may not support interception.
2676  optional InterceptorConfig interceptor_config = 115;
2677
2678  // Data source name: android.network_packets.
2679  // Introduced in Android 14 (U).
2680  optional NetworkPacketTraceConfig network_packet_trace_config = 120
2681      [lazy = true];
2682
2683  // This is a fallback mechanism to send a free-form text config to the
2684  // producer. In theory this should never be needed. All the code that
2685  // is part of the platform (i.e. traced service) is supposed to *not* truncate
2686  // the trace config proto and propagate unknown fields. However, if anything
2687  // in the pipeline (client or backend) ends up breaking this forward compat
2688  // plan, this field will become the escape hatch to allow future data sources
2689  // to get some meaningful configuration.
2690  optional string legacy_config = 1000;
2691
2692  // This field is only used for testing.
2693  optional TestConfig for_testing = 1001;
2694
2695  // Was |for_testing|. Caused more problems then found.
2696  reserved 268435455;
2697}
2698
2699// End of protos/perfetto/config/data_source_config.proto
2700
2701// Begin of protos/perfetto/config/trace_config.proto
2702
2703// The overall config that is used when starting a new tracing session through
2704// ProducerPort::StartTracing().
2705// It contains the general config for the logging buffer(s) and the configs for
2706// all the data source being enabled.
2707//
2708// Next id: 38.
2709message TraceConfig {
2710  message BufferConfig {
2711    optional uint32 size_kb = 1;
2712
2713    // |page_size|, now deprecated.
2714    reserved 2;
2715
2716    // |optimize_for|, now deprecated.
2717    reserved 3;
2718
2719    enum FillPolicy {
2720      UNSPECIFIED = 0;
2721
2722      // Default behavior. The buffer operates as a conventional ring buffer.
2723      // If the writer is faster than the reader (or if the reader reads only
2724      // after tracing is stopped) newly written packets will overwrite old
2725      // packets.
2726      RING_BUFFER = 1;
2727
2728      // Behaves like RING_BUFFER as long as there is space in the buffer or
2729      // the reader catches up with the writer. As soon as the writer hits
2730      // an unread chunk, it stops accepting new data in the buffer.
2731      DISCARD = 2;
2732    }
2733    optional FillPolicy fill_policy = 4;
2734  }
2735  repeated BufferConfig buffers = 1;
2736
2737  message DataSource {
2738    // Filters and data-source specific config. It contains also the unique name
2739    // of the data source, the one passed in the  DataSourceDescriptor when they
2740    // register on the service.
2741    optional protos.DataSourceConfig config = 1;
2742
2743    // Optional. If multiple producers (~processes) expose the same data source
2744    // and either |producer_name_filter| or |producer_name_regex_filter| is set,
2745    // the data source is enabled only for producers whose names match any of
2746    // the filters.
2747    // |producer_name_filter| has to be an exact match, while
2748    // |producer_name_regex_filter| is a regular expression.
2749    // This allows to enable a data source only for specific processes.
2750    // The "repeated" fields have OR semantics: specifying a filter ["foo",
2751    // "bar"] will enable data sources on both "foo" and "bar" (if they exist).
2752    repeated string producer_name_filter = 2;
2753    repeated string producer_name_regex_filter = 3;
2754  }
2755  repeated DataSource data_sources = 2;
2756
2757  // Config for disabling builtin data sources in the tracing service.
2758  message BuiltinDataSource {
2759    // Disable emitting clock timestamps into the trace.
2760    optional bool disable_clock_snapshotting = 1;
2761
2762    // Disable echoing the original trace config in the trace.
2763    optional bool disable_trace_config = 2;
2764
2765    // Disable emitting system info (build fingerprint, cpuinfo, etc).
2766    optional bool disable_system_info = 3;
2767
2768    // Disable emitting events for data-source state changes (e.g. the marker
2769    // for all data sources having ACKed the start of the trace).
2770    optional bool disable_service_events = 4;
2771
2772    // The authoritative clock domain for the trace. Defaults to BOOTTIME. See
2773    // also ClockSnapshot's primary_trace_clock. The configured value is written
2774    // into the trace as part of the ClockSnapshots emitted by the service.
2775    // Trace processor will attempt to translate packet/event timestamps from
2776    // various data sources (and their chosen clock domains) to this domain
2777    // during import. Added in Android R.
2778    optional BuiltinClock primary_trace_clock = 5;
2779
2780    // Time interval in between snapshotting of sync markers, clock snapshots,
2781    // stats, and other periodic service-emitted events. Note that the service
2782    // only keeps track of the first and the most recent snapshot until
2783    // ReadBuffers() is called.
2784    optional uint32 snapshot_interval_ms = 6;
2785
2786    // Hints to the service that a suspend-aware (i.e. counting time in suspend)
2787    // clock should be used for periodic snapshots of service-emitted events.
2788    // This means, if a snapshot *should* have happened during suspend, it will
2789    // happen immediately after the device resumes.
2790    //
2791    // Choosing a clock like this is done on best-effort basis; not all
2792    // platforms (e.g. Windows) expose a clock which can be used for periodic
2793    // tasks counting suspend. If such a clock is not available, the service
2794    // falls back to the best-available alternative.
2795    //
2796    // Introduced in Android S.
2797    // TODO(lalitm): deprecate this in T and make this the default if nothing
2798    // crashes in S.
2799    optional bool prefer_suspend_clock_for_snapshot = 7;
2800
2801    // Disables the reporting of per-trace-writer histograms in TraceStats.
2802    optional bool disable_chunk_usage_histograms = 8;
2803  }
2804  optional BuiltinDataSource builtin_data_sources = 20;
2805
2806  // If specified, the trace will be stopped |duration_ms| after starting.
2807  // This does *not* count the time the system is suspended, so we will run
2808  // for duration_ms of system activity, not wall time.
2809  //
2810  // However in case of traces with triggers, see
2811  // TriggerConfig.trigger_timeout_ms instead.
2812  optional uint32 duration_ms = 3;
2813
2814  // If true, tries to use CLOCK_BOOTTIME for duration_ms rather than
2815  // CLOCK_MONOTONIC (which doesn't count time in suspend). Supported only on
2816  // Linux/Android, no-op on other platforms. This is used when dealing with
2817  // long (e.g. 24h) traces, where suspend can inflate them to weeks of
2818  // wall-time, making them more likely to hit device reboots (and hence loss).
2819  // This option also changes consistently the semantic of
2820  // TrigerConfig.stop_delay_ms.
2821  optional bool prefer_suspend_clock_for_duration = 36;
2822
2823  // This is set when --dropbox is passed to the Perfetto command line client
2824  // and enables guardrails that limit resource usage for traces requested
2825  // by statsd.
2826  optional bool enable_extra_guardrails = 4;
2827
2828  enum LockdownModeOperation {
2829    LOCKDOWN_UNCHANGED = 0;
2830    LOCKDOWN_CLEAR = 1;
2831    LOCKDOWN_SET = 2;
2832  }
2833  // Reject producers that are not running under the same UID as the tracing
2834  // service.
2835  optional LockdownModeOperation lockdown_mode = 5;
2836
2837  message ProducerConfig {
2838    // Identifies the producer for which this config is for.
2839    optional string producer_name = 1;
2840
2841    // Specifies the preferred size of the shared memory buffer. If the size is
2842    // larger than the max size, the max will be used. If it is smaller than
2843    // the page size or doesn't fit pages evenly into it, it will fall back to
2844    // the size specified by the producer or finally the default shared memory
2845    // size.
2846    optional uint32 shm_size_kb = 2;
2847
2848    // Specifies the preferred size of each page in the shared memory buffer.
2849    // Must be an integer multiple of 4K.
2850    optional uint32 page_size_kb = 3;
2851  }
2852
2853  repeated ProducerConfig producers = 6;
2854
2855  // Contains statsd-specific metadata about an alert associated with the trace.
2856  message StatsdMetadata {
2857    // The identifier of the alert which triggered this trace.
2858    optional int64 triggering_alert_id = 1;
2859    // The uid which registered the triggering configuration with statsd.
2860    optional int32 triggering_config_uid = 2;
2861    // The identifier of the config which triggered the alert.
2862    optional int64 triggering_config_id = 3;
2863    // The identifier of the subscription which triggered this trace.
2864    optional int64 triggering_subscription_id = 4;
2865  }
2866
2867  // Statsd-specific metadata.
2868  optional StatsdMetadata statsd_metadata = 7;
2869
2870  // When true && |output_path| is empty, the EnableTracing() request must
2871  // provide a file descriptor. The service will then periodically read packets
2872  // out of the trace buffer and store it into the passed file.
2873  // If |output_path| is not empty no fd should be passed, the service
2874  // will create a new file and write into that (see comment below).
2875  optional bool write_into_file = 8;
2876
2877  // This must point to a non-existing file. If the file exists the service
2878  // will NOT overwrite and will fail instead as a security precaution.
2879  // On Android, when this is used with the system traced, the path must be
2880  // within /data/misc/perfetto-traces/ or the trace will fail.
2881  // This option has been introduced in Android R. Before R write_into_file
2882  // can be used only with the "pass a file descriptor over IPC" mode.
2883  optional string output_path = 29;
2884
2885  // Optional. If non-zero tunes the write period. A min value of 100ms is
2886  // enforced (i.e. smaller values are ignored).
2887  optional uint32 file_write_period_ms = 9;
2888
2889  // Optional. When non zero the periodic write stops once at most X bytes
2890  // have been written into the file. Tracing is disabled when this limit is
2891  // reached, even if |duration_ms| has not been reached yet.
2892  optional uint64 max_file_size_bytes = 10;
2893
2894  // Contains flags which override the default values of the guardrails inside
2895  // Perfetto.
2896  message GuardrailOverrides {
2897    // Override the default limit (in bytes) for uploading data to server within
2898    // a 24 hour period.
2899    // On R-, this override only affected userdebug builds. Since S, it also
2900    // affects user builds.
2901    optional uint64 max_upload_per_day_bytes = 1;
2902
2903    // Overrides the guardrail for maximum trace buffer size.
2904    // Available on U+
2905    optional uint32 max_tracing_buffer_size_kb = 2;
2906  }
2907  optional GuardrailOverrides guardrail_overrides = 11;
2908
2909  // When true, data sources are not started until an explicit call to
2910  // StartTracing() on the consumer port. This is to support early
2911  // initialization and fast trace triggering. This can be used only when the
2912  // Consumer explicitly triggers the StartTracing() method.
2913  // This should not be used in a remote trace config via statsd, doing so will
2914  // result in a hung trace session.
2915  optional bool deferred_start = 12;
2916
2917  // When set, it periodically issues a Flush() to all data source, forcing them
2918  // to commit their data into the tracing service. This can be used for
2919  // quasi-real-time streaming mode and to guarantee some partial ordering of
2920  // events in the trace in windows of X ms.
2921  optional uint32 flush_period_ms = 13;
2922
2923  // Wait for this long for producers to acknowledge flush requests.
2924  // Default 5s.
2925  optional uint32 flush_timeout_ms = 14;
2926
2927  // Wait for this long for producers to acknowledge stop requests.
2928  // Default 5s.
2929  optional uint32 data_source_stop_timeout_ms = 23;
2930
2931  // |disable_clock_snapshotting| moved.
2932  reserved 15;
2933
2934  // Android-only. If set, sends an intent to the Traceur system app when the
2935  // trace ends to notify it about the trace readiness.
2936  optional bool notify_traceur = 16;
2937
2938  // This field was introduced in Android S.
2939  // Android-only. If set to a value > 0, marks the trace session as a candidate
2940  // for being attached to a bugreport. This field effectively acts as a z-index
2941  // for bugreports. When Android's dumpstate runs perfetto
2942  // --save-for-bugreport, traced will pick the tracing session with the highest
2943  // score (score <= 0 is ignored) and:
2944  // On Android S, T:  will steal its contents, save the trace into
2945  //     a known path and stop prematurely.
2946  // On Android U+: will create a read-only snapshot and save that into a known
2947  //     path, without stoppin the original tracing session.
2948  // When this field is set the tracing session becomes eligible to be cloned
2949  // by other UIDs.
2950  optional int32 bugreport_score = 30;
2951
2952  // Triggers allow producers to start or stop the tracing session when an event
2953  // occurs.
2954  //
2955  // For example if we are tracing probabilistically, most traces will be
2956  // uninteresting. Triggers allow us to keep only the interesting ones such as
2957  // those traces during which the device temperature reached a certain
2958  // threshold. In this case the producer can activate a trigger to keep
2959  // (STOP_TRACING) the trace, otherwise it can also begin a trace
2960  // (START_TRACING) because it knows something is about to happen.
2961  message TriggerConfig {
2962    enum TriggerMode {
2963      UNSPECIFIED = 0;
2964
2965      // When this mode is chosen, data sources are not started until one of the
2966      // |triggers| are received. This supports early initialization and fast
2967      // starting of the tracing system. On triggering, the session will then
2968      // record for |stop_delay_ms|. However if no trigger is seen
2969      // after |trigger_timeout_ms| the session will be stopped and no data will
2970      // be returned.
2971      START_TRACING = 1;
2972
2973      // When this mode is chosen, the session will be started via the normal
2974      // EnableTracing() & StartTracing(). If no trigger is ever seen
2975      // the session will be stopped after |trigger_timeout_ms| and no data will
2976      // be returned. However if triggered the trace will stop after
2977      // |stop_delay_ms| and any data in the buffer will be returned to the
2978      // consumer.
2979      STOP_TRACING = 2;
2980
2981      // 3 was taken by CLONE_SNAPSHOT but that has been moved to 4.
2982      // The early implementation of CLONE_SNAPSHOT had various bugs
2983      // (b/290798988, b/290799105) and made it into Android U. The number
2984      // change is to make sure nobody rolls out a config that hits the broken
2985      // behaviour.
2986      reserved 3;
2987
2988      // When this mode is chosen, this causes a snapshot of the current tracing
2989      // session to be created after |stop_delay_ms| while the current tracing
2990      // session continues undisturbed (% an extra flush). This mode can be
2991      // used only when the tracing session is handled by the "perfetto" cmdline
2992      // client (which is true in 90% of cases). Part of the business logic
2993      // necessary for this behavior, and ensuing file handling, lives in
2994      // perfetto_cmd.cc . On other consumers, this causes only a notification
2995      // of the trigger through a CloneTriggerHit ObservableEvent. The custom
2996      // consumer is supposed to call CloneSession() itself after the event.
2997      // Use use_clone_snapshot_if_available=true when targeting older versions
2998      // of perfetto.
2999      CLONE_SNAPSHOT = 4;
3000
3001      // NOTE: CLONE_SNAPSHOT should be used only when we targeting Android V+
3002      // (15+) / Perfetto v38+. A bug in older versions of the tracing service
3003      // might cause indefinitely long tracing sessions (see b/274931668).
3004    }
3005    optional TriggerMode trigger_mode = 1;
3006
3007    // This flag is really a workaround for b/274931668. This is needed only
3008    // when deploying configs to different versions of the tracing service.
3009    // When this is set to true this has the same effect of setting trigger_mode
3010    // to CLONE_SNAPSHOT on newer versions of the service. This boolean has been
3011    // introduced to allow to have configs that use CLONE_SNAPSHOT on newer
3012    // versions of Android and fall back to STOP_TRACING on older versions where
3013    // CLONE_SNAPSHOT did not exist.
3014    // When using this flag, trigger_mode must be set to STOP_TRACING.
3015    optional bool use_clone_snapshot_if_available = 5;
3016
3017    // DEPRECATED, was use_clone_snapshot_if_available in U. See the comment
3018    // around CLONE_SNAPSHOT.
3019    reserved 4;
3020
3021    message Trigger {
3022      // The producer must specify this name to activate the trigger.
3023      optional string name = 1;
3024
3025      // An std::regex that will match the producer that can activate this
3026      // trigger. This is optional. If unset any producers can activate this
3027      // trigger.
3028      optional string producer_name_regex = 2;
3029
3030      // After a trigger is received either in START_TRACING or STOP_TRACING
3031      // mode then the trace will end |stop_delay_ms| after triggering.
3032      // In CLONE_SNAPSHOT mode, this is the delay between the trigger and the
3033      // snapshot.
3034      // If |prefer_suspend_clock_for_duration| is set, the duration will be
3035      // based on wall-clock, counting also time in suspend.
3036      optional uint32 stop_delay_ms = 3;
3037
3038      // Limits the number of traces this trigger can start/stop in a rolling
3039      // 24 hour window. If this field is unset or zero, no limit is applied and
3040      // activiation of this trigger *always* starts/stops the trace.
3041      optional uint32 max_per_24_h = 4;
3042
3043      // A value between 0 and 1 which encodes the probability of skipping a
3044      // trigger with this name. This is useful for reducing the probability
3045      // of high-frequency triggers from dominating trace finaization. If this
3046      // field is unset or zero, the trigger will *never* be skipped. If this
3047      // field is greater than or equal to 1, this trigger will *always* be
3048      // skipped i.e. it will be as if this trigger was never included in the
3049      // first place.
3050      // This probability check is applied *before* any other limits. For
3051      // example, if |max_per_24_h| is also set, first we will check if the
3052      // probability bar is met and only then will we check the |max_per_24_h|
3053      // limit.
3054      optional double skip_probability = 5;
3055    }
3056    // A list of triggers which are related to this configuration. If ANY
3057    // trigger is seen then an action will be performed based on |trigger_mode|.
3058    repeated Trigger triggers = 2;
3059
3060    // Required and must be positive if a TriggerConfig is specified. This is
3061    // how long this TraceConfig should wait for a trigger to arrive. After this
3062    // period of time if no trigger is seen the TracingSession will be cleaned
3063    // up.
3064    optional uint32 trigger_timeout_ms = 3;
3065  }
3066  optional TriggerConfig trigger_config = 17;
3067
3068  // When this is non-empty the perfetto command line tool will ignore the rest
3069  // of this TraceConfig and instead connect to the perfetto service as a
3070  // producer and send these triggers, potentially stopping or starting traces
3071  // that were previous configured to use a TriggerConfig.
3072  repeated string activate_triggers = 18;
3073
3074  // Configuration for trace contents that reference earlier trace data. For
3075  // example, a data source might intern strings, and emit packets containing
3076  // {interned id : string} pairs. Future packets from that data source can then
3077  // use the interned ids instead of duplicating the raw string contents. The
3078  // trace parser will then need to use that interning table to fully interpret
3079  // the rest of the trace.
3080  message IncrementalStateConfig {
3081    // If nonzero, notify eligible data sources to clear their incremental state
3082    // periodically, with the given period. The notification is sent only to
3083    // data sources that have |handles_incremental_state_clear| set in their
3084    // DataSourceDescriptor. The notification requests that the data source
3085    // stops referring to past trace contents. This is particularly useful when
3086    // tracing in ring buffer mode, where it is not exceptional to overwrite old
3087    // trace data.
3088    //
3089    // Warning: this time-based global clearing is likely to be removed in the
3090    // future, to be replaced with a smarter way of sending the notifications
3091    // only when necessary.
3092    optional uint32 clear_period_ms = 1;
3093  }
3094  optional IncrementalStateConfig incremental_state_config = 21;
3095
3096  // Additional guardrail used by the Perfetto command line client.
3097  // On user builds when --dropbox is set perfetto will refuse to trace unless
3098  // this is also set.
3099  // Added in Q.
3100  optional bool allow_user_build_tracing = 19;
3101
3102  // If set the tracing service will ensure there is at most one tracing session
3103  // with this key.
3104  optional string unique_session_name = 22;
3105
3106  // Compress trace with the given method. Best effort.
3107  enum CompressionType {
3108    COMPRESSION_TYPE_UNSPECIFIED = 0;
3109    COMPRESSION_TYPE_DEFLATE = 1;
3110  }
3111  optional CompressionType compression_type = 24;
3112
3113  // Use the legacy codepath that compresses from perfetto_cmd.cc instead of
3114  // using the new codepath that compresses from tracing_service_impl.cc. This
3115  // will be removed in the future.
3116  optional bool compress_from_cli = 37;
3117
3118  // Android-only. Not for general use. If set, saves the trace into an
3119  // incident. This field is read by perfetto_cmd, rather than the tracing
3120  // service. This field must be set when passing the --upload flag to
3121  // perfetto_cmd.
3122  message IncidentReportConfig {
3123    // In this message, either:
3124    //  * all of |destination_package|, |destination_class| and |privacy_level|
3125    //    must be set.
3126    //  * |skip_incidentd| must be explicitly set to true.
3127
3128    optional string destination_package = 1;
3129    optional string destination_class = 2;
3130    // Level of filtering in the requested incident. See |Destination| in
3131    // frameworks/base/core/proto/android/privacy.proto.
3132    optional int32 privacy_level = 3;
3133
3134    // If true, then skips saving the trace to incidentd.
3135    //
3136    // This flag is useful in testing (e.g. Perfetto-statsd integration tests)
3137    // or when we explicitly don't want traces to go to incidentd even when they
3138    // usually would (e.g. configs deployed using statsd but only used for
3139    // inclusion in bugreports using |bugreport_score|).
3140    //
3141    // The motivation for having this flag, instead of just not setting
3142    // |incident_report_config|, is prevent accidents where
3143    // |incident_report_config| is omitted by mistake.
3144    optional bool skip_incidentd = 5;
3145
3146    // If true, do not write the trace into dropbox (i.e. incident only).
3147    // Otherwise, write to both dropbox and incident.
3148    // TODO(lalitm): remove this field as we no longer use Dropbox.
3149    optional bool skip_dropbox = 4 [deprecated = true];
3150  }
3151  optional IncidentReportConfig incident_report_config = 25;
3152
3153  enum StatsdLogging {
3154    STATSD_LOGGING_UNSPECIFIED = 0;
3155    STATSD_LOGGING_ENABLED = 1;
3156    STATSD_LOGGING_DISABLED = 2;
3157  }
3158
3159  // Android-only. Not for general use. If specified, sets the logging to statsd
3160  // of guardrails and checkpoints in the tracing service. perfetto_cmd sets
3161  // this to enabled (if not explicitly set in the config) when specifying
3162  // --upload.
3163  optional StatsdLogging statsd_logging = 31;
3164
3165  // DEPRECATED. Was trace_uuid, use trace_uuid_msb and trace_uuid_lsb instead.
3166  reserved 26;
3167
3168  // An identifier clients can use to tie this trace to other logging.
3169  // DEPRECATED as per v32. See TracePacket.trace_uuid for the authoritative
3170  // Trace UUID. If this field is set, the tracing service will respect the
3171  // requested UUID (i.e. TracePacket.trace_uuid == this field) but only if
3172  // gap-less snapshotting is not used.
3173  optional int64 trace_uuid_msb = 27 [deprecated = true];
3174  optional int64 trace_uuid_lsb = 28 [deprecated = true];
3175
3176  // When set applies a post-filter to the trace contents using the filter
3177  // provided. The filter is applied at ReadBuffers() time and works both in the
3178  // case of IPC readback and write_into_file. This filter can be generated
3179  // using `tools/proto_filter -s schema.proto -F filter_out.bytes` or
3180  // `-T filter_out.escaped_string` (for .pbtx). See go/trace-filtering for
3181  // design.
3182  //
3183  // Introduced in Android S, but it was broken (b/195065199). Reintroduced in
3184  // Android T with a different field number. Updated in Android U with a new
3185  // bytecode version which supports string filtering.
3186  message TraceFilter {
3187    // =========================
3188    // Filter bytecode.
3189    // =========================
3190
3191    // The bytecode as implemented in Android T.
3192    optional bytes bytecode = 1;
3193
3194    // The bytecode as implemented in Android U. Adds support for string
3195    // filtering.
3196    optional bytes bytecode_v2 = 2;
3197
3198    // =========================
3199    // String filtering
3200    // =========================
3201
3202    // The principles and terminology of string filtering is heavily inspired by
3203    // iptables. A "rule" decide how strings should be filtered. Each rule
3204    // contains a "policy" which indicates the algorithm to use for filtering.
3205    // A "chain" is a list of rules which will be sequentially checked against
3206    // each string.
3207    //
3208    // The first rule which applies to the string terminates filtering for that
3209    // string. If no rules apply, the string is left unchanged.
3210
3211    // A policy specifies which algorithm should be used for filtering the
3212    // string.
3213    enum StringFilterPolicy {
3214      SFP_UNSPECIFIED = 0;
3215
3216      // Tries to match the string field against |regex_pattern|. If it
3217      // matches, all matching groups are "redacted" (i.e. replaced with a
3218      // constant string) and filtering is terminated (i.e. no further rules are
3219      // checked). If it doesn't match, the string is left unchanged and the
3220      // next rule in chain is considered.
3221      SFP_MATCH_REDACT_GROUPS = 1;
3222
3223      // Like |SFP_MATCH_REDACT_GROUPS| but tries to do some pre-work before
3224      // checking the regex. Specifically, it tries to parse the string field as
3225      // an atrace tracepoint and checks if the post-tgid field starts with
3226      // |atrace_post_tgid_starts_with|. The regex matching is only performed if
3227      // this check succeeds.
3228      SFP_ATRACE_MATCH_REDACT_GROUPS = 2;
3229
3230      // Tries to match the string field against |regex_pattern|. If it
3231      // matches, filtering is terminated (i.e. no further rules are checked).
3232      // If it doesn't match, the string is left unchanged and the next rule in
3233      // chain is considered.
3234      SFP_MATCH_BREAK = 3;
3235
3236      // Like |SFP_MATCH_BREAK| but tries to do some pre-work before checking
3237      // the regex. Specifically, it tries to parse the string field as an
3238      // atrace tracepoint and checks if the post-tgid field starts with
3239      // |atrace_post_tgid_starts_with|. The regex matching is only performed if
3240      // this check succeeds.
3241      SFP_ATRACE_MATCH_BREAK = 4;
3242    }
3243
3244    // A rule specifies how strings should be filtered.
3245    message StringFilterRule {
3246      // The policy (i.e. algorithm) dictating how strings matching this rule
3247      // should be handled.
3248      optional StringFilterPolicy policy = 1;
3249
3250      // The regex pattern used to match against each string.
3251      optional string regex_pattern = 2;
3252
3253      // The string which should appear after the tgid in atrace tracepoint
3254      // strings.
3255      optional string atrace_payload_starts_with = 3;
3256    }
3257
3258    // A chain is a list of rules which string will be sequentially checked
3259    // against.
3260    message StringFilterChain {
3261      repeated StringFilterRule rules = 1;
3262    }
3263    optional StringFilterChain string_filter_chain = 3;
3264  }
3265  // old field number for trace_filter
3266  reserved 32;
3267  optional TraceFilter trace_filter = 33;
3268
3269  // Android-only. Not for general use. If set, reports the trace to the
3270  // Android framework. This field is read by perfetto_cmd, rather than the
3271  // tracing service. This field must be set when passing the --upload flag to
3272  // perfetto_cmd.
3273  message AndroidReportConfig {
3274    // In this message, either:
3275    //  * |reporter_service_package| and |reporter_service_class| must be set.
3276    //  * |skip_reporting| must be explicitly set to true.
3277
3278    optional string reporter_service_package = 1;
3279    optional string reporter_service_class = 2;
3280
3281    // If true, then skips reporting the trace to Android framework.
3282    //
3283    // This flag is useful in testing (e.g. Perfetto-statsd integration tests)
3284    // or when we explicitly don't want to report traces to the framework even
3285    // when they usually would (e.g. configs deployed using statsd but only
3286    // used for inclusion in bugreports using |bugreport_score|).
3287    //
3288    // The motivation for having this flag, instead of just not setting
3289    // |framework_report_config|, is prevent accidents where
3290    // |framework_report_config| is omitted by mistake.
3291    optional bool skip_report = 3;
3292
3293    // If true, will direct the Android framework to read the data in trace
3294    // file and pass it to the reporter class over a pipe instead of passing
3295    // the file descriptor directly.
3296    //
3297    // This flag is needed because the Android test framework does not
3298    // currently support priv-app helper apps (in terms of SELinux) and we
3299    // really don't want to add an allow rule for untrusted_app to receive
3300    // trace fds.
3301    //
3302    // Because of this, we instead will direct the framework to create a new
3303    // pipe and pass this to the reporter process instead. As the pipe is
3304    // created by the framework, we won't have any problems with SELinux
3305    // (system_server is already allowed to pass pipe fds, even
3306    // to untrusted apps).
3307    //
3308    // As the name suggests this option *MUST* only be used for testing.
3309    // Note that the framework will reject (and drop) files which are too
3310    // large both for simplicity and to be minimize the amount of data we
3311    // pass to a non-priv app (note that the framework will still check
3312    // manifest permissions even though SELinux permissions are worked around).
3313    optional bool use_pipe_in_framework_for_testing = 4;
3314  }
3315  optional AndroidReportConfig android_report_config = 34;
3316
3317  // If set, delays the start of tracing by a random duration. The duration is
3318  // chosen from a uniform distribution between the specified minimum and
3319  // maximum.
3320  // Note: this delay is implemented by perfetto_cmd *not* by traced so will
3321  // not work if you communicate with traced directly over the consumer API.
3322  // Introduced in Android T.
3323  message CmdTraceStartDelay {
3324    optional uint32 min_delay_ms = 1;
3325    optional uint32 max_delay_ms = 2;
3326  }
3327  optional CmdTraceStartDelay cmd_trace_start_delay = 35;
3328}
3329
3330// End of protos/perfetto/config/trace_config.proto
3331