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
14// Begin of protos/perfetto/common/gpu_counter_descriptor.proto
15
16// Description of GPU counters.
17// This message is sent by a GPU counter producer to specify the counters
18// available in the hardware.
19message GpuCounterDescriptor {
20  // Logical groups for a counter.  This is used in the UI to present the
21  // related counters together.
22  enum GpuCounterGroup {
23    UNCLASSIFIED = 0;
24    SYSTEM = 1;
25    VERTICES = 2;
26    FRAGMENTS = 3;
27    PRIMITIVES = 4;
28    // Includes counters relating to caching and bandwidth.
29    MEMORY = 5;
30    COMPUTE = 6;
31  }
32
33  message GpuCounterSpec {
34    optional uint32 counter_id = 1;
35    optional string name = 2;
36    optional string description = 3;
37    // MeasureUnit unit (deprecated)
38    reserved 4;
39    oneof peak_value {
40      int64 int_peak_value = 5;
41      double double_peak_value = 6;
42    }
43    repeated MeasureUnit numerator_units = 7;
44    repeated MeasureUnit denominator_units = 8;
45    optional bool select_by_default = 9;
46    repeated GpuCounterGroup groups = 10;
47  }
48  repeated GpuCounterSpec specs = 1;
49
50  // Allow producer to group counters into block to represent counter islands.
51  // A capacity may be specified to indicate the number of counters that can be
52  // enable simultaneously in that block.
53  message GpuCounterBlock {
54    // required. Unique ID for the counter group.
55    optional uint32 block_id = 1;
56    // optional. Number of counters supported by the block. No limit if unset.
57    optional uint32 block_capacity = 2;
58    // optional. Name of block.
59    optional string name = 3;
60    // optional. Description for the block.
61    optional string description = 4;
62    // list of counters that are part of the block.
63    repeated uint32 counter_ids = 5;
64  }
65  repeated GpuCounterBlock blocks = 2;
66
67  // optional.  Minimum sampling period supported by the producer in
68  // nanoseconds.
69  optional uint64 min_sampling_period_ns = 3;
70
71  // optional.  Maximum sampling period supported by the producer in
72  // nanoseconds.
73  optional uint64 max_sampling_period_ns = 4;
74
75  // optional.  The producer supports counter sampling by instrumenting the
76  // command buffer.
77  optional bool supports_instrumented_sampling = 5;
78
79  // next id: 41
80  enum MeasureUnit {
81    NONE = 0;
82
83    BIT = 1;
84    KILOBIT = 2;
85    MEGABIT = 3;
86    GIGABIT = 4;
87    TERABIT = 5;
88    PETABIT = 6;
89
90    BYTE = 7;
91    KILOBYTE = 8;
92    MEGABYTE = 9;
93    GIGABYTE = 10;
94    TERABYTE = 11;
95    PETABYTE = 12;
96
97    HERTZ = 13;
98    KILOHERTZ = 14;
99    MEGAHERTZ = 15;
100    GIGAHERTZ = 16;
101    TERAHERTZ = 17;
102    PETAHERTZ = 18;
103
104    NANOSECOND = 19;
105    MICROSECOND = 20;
106    MILLISECOND = 21;
107    SECOND = 22;
108    MINUTE = 23;
109    HOUR = 24;
110
111    VERTEX = 25;
112    PIXEL = 26;
113    TRIANGLE = 27;
114    PRIMITIVE = 38;
115    FRAGMENT = 39;
116
117    MILLIWATT = 28;
118    WATT = 29;
119    KILOWATT = 30;
120
121    JOULE = 31;
122    VOLT = 32;
123    AMPERE = 33;
124
125    CELSIUS = 34;
126    FAHRENHEIT = 35;
127    KELVIN = 36;
128
129    // Values should be out of 100.
130    PERCENT = 37;
131
132    INSTRUCTION = 40;
133  }
134}
135
136// End of protos/perfetto/common/gpu_counter_descriptor.proto
137
138// Begin of protos/perfetto/common/track_event_descriptor.proto
139
140message TrackEventCategory {
141  optional string name = 1;
142  optional string description = 2;
143  repeated string tags = 3;
144}
145
146message TrackEventDescriptor {
147  repeated TrackEventCategory available_categories = 1;
148}
149
150// End of protos/perfetto/common/track_event_descriptor.proto
151
152// Begin of protos/perfetto/common/data_source_descriptor.proto
153
154// This message is sent from Producer(s) to the tracing Service when registering
155// to advertise their capabilities. It describes the structure of tracing
156// protos that will be produced by the data source and the supported filters.
157message DataSourceDescriptor {
158  // e.g., "linux.ftrace", "chromium.tracing"
159  optional string name = 1;
160
161  // When true the data source is expected to ack the stop request through the
162  // NotifyDataSourceStopped() IPC. This field has been introduced after
163  // Android P in Jul 2018 and is not supported on older versions.
164  optional bool will_notify_on_stop = 2;
165
166  // When true the data source is expected to ack the start request through the
167  // NotifyDataSourceStarted() IPC. This field has been introduced after
168  // Android P in March 2019 and is not supported on older versions.
169  optional bool will_notify_on_start = 3;
170
171  // If true, opt into receiving the ClearIncrementalState() IPC. This should be
172  // set if the data source writes packets that refer to previous trace
173  // contents, and knows how to stop referring to the already-emitted data.
174  optional bool handles_incremental_state_clear = 4;
175
176  // Optional specification about available GPU counters.
177  optional GpuCounterDescriptor gpu_counter_descriptor = 5 [lazy = true];
178
179  optional TrackEventDescriptor track_event_descriptor = 6 [lazy = true];
180}
181
182// End of protos/perfetto/common/data_source_descriptor.proto
183
184// Begin of protos/perfetto/common/tracing_service_state.proto
185
186// Reports the state of the tracing service. Used to gather details about the
187// data sources connected.
188// See ConsumerPort::QueryServiceState().
189message TracingServiceState {
190  // Describes a producer process.
191  message Producer {
192    // Unique ID of the producer (monotonic counter).
193    optional int32 id = 1;
194
195    // Typically matches the process name.
196    optional string name = 2;
197
198    // Unix uid of the remote process.
199    optional int32 uid = 3;
200
201    // The version of the client library used by the producer.
202    // This is a human readable string with and its format varies depending on
203    // the build system and the repo (standalone vs AOSP).
204    // This is intended for human debugging only.
205    optional string sdk_version = 4;
206  }
207
208  // Describes a data source registered by a producer. Data sources are listed
209  // regardless of the fact that they are being used or not.
210  message DataSource {
211    // Descriptor passed by the data source when calling RegisterDataSource().
212    optional DataSourceDescriptor ds_descriptor = 1;
213
214    // ID of the producer, as per Producer.id.
215    optional int32 producer_id = 2;
216  }
217
218  // Lists all the producers connected.
219  repeated Producer producers = 1;
220
221  // Lists the data sources available.
222  repeated DataSource data_sources = 2;
223
224  // Total number of tracing sessions.
225  optional int32 num_sessions = 3;
226
227  // Number of tracing sessions in the started state. Always <= num_sessions.
228  optional int32 num_sessions_started = 4;
229
230  // The version of traced (the same returned by `traced --version`).
231  // This is a human readable string with and its format varies depending on
232  // the build system and the repo (standalone vs AOSP).
233  // This is intended for human debugging only.
234  optional string tracing_service_version = 5;
235}
236
237// End of protos/perfetto/common/tracing_service_state.proto
238
239// Begin of protos/perfetto/common/builtin_clock.proto
240
241enum BuiltinClock {
242  BUILTIN_CLOCK_UNKNOWN = 0;
243  BUILTIN_CLOCK_REALTIME = 1;
244  BUILTIN_CLOCK_REALTIME_COARSE = 2;
245  BUILTIN_CLOCK_MONOTONIC = 3;
246  BUILTIN_CLOCK_MONOTONIC_COARSE = 4;
247  BUILTIN_CLOCK_MONOTONIC_RAW = 5;
248  BUILTIN_CLOCK_BOOTTIME = 6;
249  BUILTIN_CLOCK_MAX_ID = 63;
250
251  reserved 7, 8;
252}
253
254// End of protos/perfetto/common/builtin_clock.proto
255
256// Begin of protos/perfetto/common/android_log_constants.proto
257
258// Values from NDK's android/log.h.
259enum AndroidLogId {
260  // MAIN.
261  LID_DEFAULT = 0;
262
263  LID_RADIO = 1;
264  LID_EVENTS = 2;
265  LID_SYSTEM = 3;
266  LID_CRASH = 4;
267  LID_STATS = 5;
268  LID_SECURITY = 6;
269  LID_KERNEL = 7;
270}
271
272enum AndroidLogPriority {
273  PRIO_UNSPECIFIED = 0;
274
275  // _DEFAULT, but should never be seen in logs.
276  PRIO_UNUSED = 1;
277
278  PRIO_VERBOSE = 2;
279  PRIO_DEBUG = 3;
280  PRIO_INFO = 4;
281  PRIO_WARN = 5;
282  PRIO_ERROR = 6;
283  PRIO_FATAL = 7;
284}
285
286// End of protos/perfetto/common/android_log_constants.proto
287
288// Begin of protos/perfetto/config/android/android_log_config.proto
289
290message AndroidLogConfig {
291  repeated AndroidLogId log_ids = 1;
292
293  // Was |poll_ms|, deprecated.
294  reserved 2;
295
296  // If set ignores all log messages whose prio is < the given value.
297  optional AndroidLogPriority min_prio = 3;
298
299  // If non-empty ignores all log messages whose tag doesn't match one of the
300  // specified values.
301  repeated string filter_tags = 4;
302}
303
304// End of protos/perfetto/config/android/android_log_config.proto
305
306// Begin of protos/perfetto/config/android/android_polled_state_config.proto
307
308// Data source that polls for display state.
309message AndroidPolledStateConfig {
310  // Frequency of polling. If absent the state will be recorded once, at the
311  // start of the trace.
312  // This is required to be > 100ms to avoid excessive CPU usage.
313  optional uint32 poll_ms = 1;
314}
315
316// End of protos/perfetto/config/android/android_polled_state_config.proto
317
318// Begin of protos/perfetto/config/android/packages_list_config.proto
319
320// Data source that lists details (such as version code) about packages on an
321// Android device.
322message PackagesListConfig {
323  // If not empty, emit info about only the following list of package names
324  // (exact match, no regex). Otherwise, emit info about all packages.
325  repeated string package_name_filter = 1;
326}
327
328// End of protos/perfetto/config/android/packages_list_config.proto
329
330// Begin of protos/perfetto/config/chrome/chrome_config.proto
331
332message ChromeConfig {
333  optional string trace_config = 1;
334
335  // When enabled, the data source should only fill in fields in the output that
336  // are not potentially privacy sensitive.
337  optional bool privacy_filtering_enabled = 2;
338
339  // Instead of emitting binary protobuf, convert the trace data to the legacy
340  // JSON format. Note that the trace data will still be returned as a series of
341  // TracePackets, but the embedded data will be JSON instead of serialized
342  // protobuf.
343  optional bool convert_to_legacy_json = 3;
344
345  // Priority of the tracing session client. A higher priority session may
346  // preempt a lower priority one in configurations where concurrent sessions
347  // aren't supported.
348  enum ClientPriority {
349    UNKNOWN = 0;
350    BACKGROUND = 1;
351    USER_INITIATED = 2;
352  }
353  optional ClientPriority client_priority = 4;
354
355  // Applicable only when using legacy JSON format.
356  // If |json_agent_label_filter| is not empty, only data pertaining to
357  // the specified tracing agent label (e.g. "traceEvents") will be returned.
358  optional string json_agent_label_filter = 5;
359}
360
361// End of protos/perfetto/config/chrome/chrome_config.proto
362
363// Begin of protos/perfetto/config/ftrace/ftrace_config.proto
364
365message FtraceConfig {
366  repeated string ftrace_events = 1;
367  repeated string atrace_categories = 2;
368  repeated string atrace_apps = 3;
369  // *Per-CPU* buffer size.
370  optional uint32 buffer_size_kb = 10;
371  optional uint32 drain_period_ms = 11;
372
373  // Configuration for compact encoding of scheduler events. When enabled (and
374  // recording the relevant ftrace events), specific high-volume events are
375  // encoded in a denser format than normal.
376  message CompactSchedConfig {
377    // If true, and sched_switch or sched_waking ftrace events are enabled,
378    // record those events in the compact format.
379    optional bool enabled = 1;
380  }
381  optional CompactSchedConfig compact_sched = 12;
382
383  // Enables symbol name resolution against /proc/kallsyms.
384  // It requires that either traced_probes is running as root or that
385  // kptr_restrict has been manually lowered.
386  // It does not disclose KASLR, symbol addresses are mangled.
387  optional bool symbolize_ksyms = 13;
388
389  // By default the kernel symbolizer is lazily initialized on a deferred task
390  // to reduce ftrace's time-to-start-recording. Unfortunately that makes
391  // ksyms integration tests hard. This flag forces the kernel symbolizer to be
392  // initialized synchronously on the data source start and hence avoiding
393  // timing races in tests.
394  optional bool initialize_ksyms_synchronously_for_testing = 14;
395}
396
397// End of protos/perfetto/config/ftrace/ftrace_config.proto
398
399// Begin of protos/perfetto/config/gpu/gpu_counter_config.proto
400
401message GpuCounterConfig {
402  // Desired sampling interval for counters.
403  optional uint64 counter_period_ns = 1;
404
405  // List of counters to be sampled. Counter IDs correspond to the ones
406  // described in GpuCounterSpec in the data source descriptor.
407  repeated uint32 counter_ids = 2;
408
409  // Sample counters by instrumenting command buffers.
410  optional bool instrumented_sampling = 3;
411
412  // Fix gpu clock rate during trace session.
413  optional bool fix_gpu_clock = 4;
414}
415
416// End of protos/perfetto/config/gpu/gpu_counter_config.proto
417
418// Begin of protos/perfetto/config/gpu/vulkan_memory_config.proto
419
420message VulkanMemoryConfig {
421  // Tracking driver memory usage events
422  optional bool track_driver_memory_usage = 1;
423
424  // Tracking device memory usage events
425  optional bool track_device_memory_usage = 2;
426}
427
428// End of protos/perfetto/config/gpu/vulkan_memory_config.proto
429
430// Begin of protos/perfetto/config/inode_file/inode_file_config.proto
431
432message InodeFileConfig {
433  message MountPointMappingEntry {
434    optional string mountpoint = 1;
435    repeated string scan_roots = 2;
436  }
437
438  // How long to pause between batches.
439  optional uint32 scan_interval_ms = 1;
440
441  // How long to wait before the first scan in order to accumulate inodes.
442  optional uint32 scan_delay_ms = 2;
443
444  // How many inodes to scan in one batch.
445  optional uint32 scan_batch_size = 3;
446
447  // Do not scan for inodes not found in the static map.
448  optional bool do_not_scan = 4;
449
450  // If non-empty, only scan inodes corresponding to block devices named in
451  // this list.
452  repeated string scan_mount_points = 5;
453
454  // When encountering an inode belonging to a block device corresponding
455  // to one of the mount points in this map, scan its scan_roots instead.
456  repeated MountPointMappingEntry mount_point_mapping = 6;
457}
458
459// End of protos/perfetto/config/inode_file/inode_file_config.proto
460
461// Begin of protos/perfetto/config/interceptors/console_config.proto
462
463message ConsoleConfig {
464  enum Output {
465    OUTPUT_UNSPECIFIED = 0;
466    OUTPUT_STDOUT = 1;
467    OUTPUT_STDERR = 2;
468  }
469  optional Output output = 1;
470  optional bool enable_colors = 2;
471}
472
473// End of protos/perfetto/config/interceptors/console_config.proto
474
475// Begin of protos/perfetto/config/interceptor_config.proto
476
477// Configuration for trace packet interception. Used for diverting trace data to
478// non-Perfetto sources (e.g., logging to the console, ETW) when using the
479// Perfetto SDK.
480message InterceptorConfig {
481  // Matches the name given to RegisterInterceptor().
482  optional string name = 1;
483
484  optional ConsoleConfig console_config = 100 [lazy = true];
485}
486
487// End of protos/perfetto/config/interceptor_config.proto
488
489// Begin of protos/perfetto/config/power/android_power_config.proto
490
491message AndroidPowerConfig {
492  enum BatteryCounters {
493    BATTERY_COUNTER_UNSPECIFIED = 0;
494
495    // Coulomb counter.
496    BATTERY_COUNTER_CHARGE = 1;
497
498    // Charge (%).
499    BATTERY_COUNTER_CAPACITY_PERCENT = 2;
500
501    // Instantaneous current.
502    BATTERY_COUNTER_CURRENT = 3;
503
504    // Avg current.
505    BATTERY_COUNTER_CURRENT_AVG = 4;
506  }
507  optional uint32 battery_poll_ms = 1;
508  repeated BatteryCounters battery_counters = 2;
509
510  // Where available enables per-power-rail measurements.
511  optional bool collect_power_rails = 3;
512
513  // Provides a breakdown of energy estimation for various subsystem (e.g. GPU).
514  // Available from Android S.
515  optional bool collect_energy_estimation_breakdown = 4;
516}
517
518// End of protos/perfetto/config/power/android_power_config.proto
519
520// Begin of protos/perfetto/config/process_stats/process_stats_config.proto
521
522message ProcessStatsConfig {
523  enum Quirks {
524    QUIRKS_UNSPECIFIED = 0;
525
526    // This has been deprecated and ignored as per 2018-05-01. Full scan at
527    // startup is now disabled by default and can be re-enabled using the
528    // |scan_all_processes_on_start| arg.
529    DISABLE_INITIAL_DUMP = 1 [deprecated = true];
530
531    DISABLE_ON_DEMAND = 2;
532  }
533
534  repeated Quirks quirks = 1;
535
536  // If enabled all processes will be scanned and dumped when the trace starts.
537  optional bool scan_all_processes_on_start = 2;
538
539  // If enabled thread names are also recoded (this is redundant if sched_switch
540  // is enabled).
541  optional bool record_thread_names = 3;
542
543  // If > 0 samples counters (see process_stats.proto) from
544  // /proc/pid/status and oom_score_adj every X ms.
545  // This is required to be > 100ms to avoid excessive CPU usage.
546  // TODO(primiano): add CPU cost for change this value.
547  optional uint32 proc_stats_poll_ms = 4;
548
549  // If empty samples stats for all processes. If non empty samples stats only
550  // for processes matching the given string in their argv0 (i.e. the first
551  // entry of /proc/pid/cmdline).
552  // TODO(primiano): implement this feature.
553  // repeated string proc_stats_filter = 5;
554
555  // This is required to be either = 0 or a multiple of |proc_stats_poll_ms|
556  // (default: |proc_stats_poll_ms|). If = 0, will be set to
557  // |proc_stats_poll_ms|. Non-multiples will be rounded down to the nearest
558  // multiple.
559  optional uint32 proc_stats_cache_ttl_ms = 6;
560
561  // Whether to record /proc/tid/time_in_state.
562  optional bool record_thread_time_in_state = 7;
563
564  // Size of the cache for thread time_in_state cpu freq values.
565  // If not specificed, the default is used.
566  optional uint32 thread_time_in_state_cache_size = 8;
567}
568
569// End of protos/perfetto/config/process_stats/process_stats_config.proto
570
571// Begin of protos/perfetto/config/profiling/heapprofd_config.proto
572
573// Configuration for go/heapprofd.
574// Next id: 27
575message HeapprofdConfig {
576  message ContinuousDumpConfig {
577    // ms to wait before first dump.
578    optional uint32 dump_phase_ms = 5;
579    // ms to wait between following dumps.
580    optional uint32 dump_interval_ms = 6;
581  }
582
583  // Sampling rate for all heaps not specified via heap_sampling_intervals.
584  //
585  // These are:
586  // * All heaps if heap_sampling_intervals is empty.
587  // * Those profiled due to all_heaps and not named in heaps if
588  //   heap_sampling_intervals is not empty.
589  // * The implicit libc.malloc heap if heaps is empty.
590  //
591  // Set to 1 for perfect accuracy.
592  // Otherwise, sample every sample_interval_bytes on average.
593  //
594  // See
595  // https://perfetto.dev/docs/data-sources/native-heap-profiler#sampling-interval
596  // for more details.
597  //
598  // BUGS
599  // Before Android 12, setting this to 0 would crash the target process.
600  optional uint64 sampling_interval_bytes = 1;
601
602  // If less than the given numbers of bytes are left free in the shared
603  // memory buffer, increase sampling interval by a factor of two.
604  // Adaptive sampling is disabled when set to 0.
605  optional uint64 adaptive_sampling_shmem_threshold = 24;
606  // Stop doubling the sampling_interval once the sampling interval has reached
607  // this value.
608  optional uint64 adaptive_sampling_max_sampling_interval_bytes = 25;
609
610  // E.g. surfaceflinger, com.android.phone
611  // This input is normalized in the following way: if it contains slashes,
612  // everything up to the last slash is discarded. If it contains "@",
613  // everything after the first @ is discared.
614  // E.g. /system/bin/surfaceflinger@1.0 normalizes to surfaceflinger.
615  // This transformation is also applied to the processes' command lines when
616  // matching.
617  repeated string process_cmdline = 2;
618
619  // For watermark based triggering or local debugging.
620  repeated uint64 pid = 4;
621
622  // Only profile target if it was installed by one of the packages given.
623  // Special values are:
624  // * @system: installed on the system partition
625  // * @product: installed on the product partition
626  // * @null: sideloaded
627  // Supported on Android 12+.
628  repeated string target_installed_by = 26;
629
630  // Which heaps to sample, e.g. "libc.malloc". If left empty, only samples
631  // "malloc".
632  //
633  // Introduced in Android 12.
634  repeated string heaps = 20;
635
636  // Which heaps not to sample, e.g. "libc.malloc". This is useful when used in
637  // combination with all_heaps;
638  //
639  // Introduced in Android 12.
640  repeated string exclude_heaps = 27;
641
642  optional bool stream_allocations = 23;
643
644  // If given, needs to be the same length as heaps and gives the sampling
645  // interval for the respective entry in heaps.
646  //
647  // Otherwise, sampling_interval_bytes is used.
648  //
649  // It is recommended to set sampling_interval_bytes to a reasonable default
650  // value when using this, as a value of 0 for sampling_interval_bytes will
651  // crash the target process before Android 12.
652  //
653  // Introduced in Android 12.
654  repeated uint64 heap_sampling_intervals = 22;
655
656  // Sample all heaps registered by target process. Introduced in Android 12.
657  optional bool all_heaps = 21;
658
659  // Profile all processes eligible for profiling on the system.
660  // See
661  // https://perfetto.dev/docs/data-sources/native-heap-profiler#heapprofd-targets
662  // for which processes are eligible.
663  //
664  // On unmodified userdebug builds, this will lead to system crashes. Zygote
665  // will crash when trying to launch a new process as it will have an
666  // unexpected open socket to heapprofd.
667  //
668  // heapprofd will likely be overloaded by the amount of data for low
669  // sampling intervals.
670  optional bool all = 5;
671
672  // Do not profile processes whose anon RSS + swap < given value.
673  // Introduced in Android 11.
674  optional uint32 min_anonymous_memory_kb = 15;
675
676  // Stop profile if heapprofd memory usage goes beyond the given value.
677  // Introduced in Android 11.
678  optional uint32 max_heapprofd_memory_kb = 16;
679
680  // Stop profile if heapprofd CPU time since start of this data-source
681  // goes beyond given value.
682  // Introduced in Android 11.
683  optional uint64 max_heapprofd_cpu_secs = 17;
684
685  // Do not emit function names for mappings starting with this prefix.
686  // E.g. /system to not emit symbols for any system libraries.
687  repeated string skip_symbol_prefix = 7;
688
689  // Dump at a predefined interval.
690  optional ContinuousDumpConfig continuous_dump_config = 6;
691
692  // Size of the shared memory buffer between the profiled processes and
693  // heapprofd. Defaults to 8 MiB. If larger than 500 MiB, truncated to 500
694  // MiB.
695  //
696  // Needs to be:
697  // * at least 8192,
698  // * a power of two,
699  // * a multiple of 4096.
700  optional uint64 shmem_size_bytes = 8;
701
702  // When the shmem buffer is full, block the client instead of ending the
703  // trace. Use with caution as this will significantly slow down the target
704  // process.
705  optional bool block_client = 9;
706
707  // If set, stop the trace session after blocking the client for this
708  // timeout. Needs to be larger than 100 us, otherwise no retries are done.
709  // Introduced in Android 11.
710  optional uint32 block_client_timeout_us = 14;
711
712  // Do not profile processes from startup, only match already running
713  // processes.
714  //
715  // Can not be set at the same time as no_running.
716  // Introduced in Android 11.
717  optional bool no_startup = 10;
718
719  // Do not profile running processes. Only match processes on startup.
720  //
721  // Can not be set at the same time as no_startup.
722  // Introduced in Android 11.
723  optional bool no_running = 11;
724
725  // deprecated idle_allocations.
726  reserved 12;
727
728  // Cause heapprofd to emit a single dump at the end, showing the memory usage
729  // at the point in time when the sampled heap usage of the process was at its
730  // maximum. This causes ProfilePacket.HeapSample.self_max to be set, and
731  // self_allocated and self_freed to not be set.
732  // Introduced in Android 11.
733  optional bool dump_at_max = 13;
734
735  // FEATURE FLAGS. THERE BE DRAGONS.
736
737  // Escape hatch if the session is being torn down because of a forked child
738  // that shares memory space, but is not correctly identified as a vforked
739  // child.
740  // Introduced in Android 11.
741  optional bool disable_fork_teardown = 18;
742
743  // We try to automatically detect when a target applicatation vforks but then
744  // does a memory allocation (or free). This auto-detection can be disabled
745  // with this.
746  // Introduced in Android 11.
747  optional bool disable_vfork_detection = 19;
748}
749
750// End of protos/perfetto/config/profiling/heapprofd_config.proto
751
752// Begin of protos/perfetto/config/profiling/java_hprof_config.proto
753
754// Configuration for go/heapprofd.
755message JavaHprofConfig {
756  // If dump_interval_ms != 0, the following configuration is used.
757  message ContinuousDumpConfig {
758    // ms to wait before first continuous dump.
759    // A dump is always created at the beginning of the trace.
760    optional uint32 dump_phase_ms = 1;
761    // ms to wait between following dumps.
762    optional uint32 dump_interval_ms = 2;
763  }
764
765  // This input is normalized in the following way: if it contains slashes,
766  // everything up to the last slash is discarded. If it contains "@",
767  // everything after the first @ is discared.
768  // E.g. /system/bin/surfaceflinger@1.0 normalizes to surfaceflinger.
769  // This transformation is also applied to the processes' command lines when
770  // matching.
771  repeated string process_cmdline = 1;
772
773  // For watermark based triggering or local debugging.
774  repeated uint64 pid = 2;
775
776  // Only profile target if it was installed by one of the packages given.
777  // Special values are:
778  // * @system: installed on the system partition
779  // * @product: installed on the product partition
780  // * @null: sideloaded
781  // Supported on Android 12+.
782  repeated string target_installed_by = 7;
783
784  // Dump at a predefined interval.
785  optional ContinuousDumpConfig continuous_dump_config = 3;
786
787  // Do not profile processes whose anon RSS + swap < given value.
788  optional uint32 min_anonymous_memory_kb = 4;
789
790  // Include the process' /proc/self/smaps.
791  // This only shows maps that:
792  // * start with /system
793  // * start with /vendor
794  // * start with /data/app
795  // * contain "extracted in memory from Y", where Y matches any of the above
796  optional bool dump_smaps = 5;
797
798  // Exclude objects of the following types from the profile. This can be
799  // useful if lots of uninteresting objects, e.g. "sun.misc.Cleaner".
800  repeated string ignored_types = 6;
801}
802
803// End of protos/perfetto/config/profiling/java_hprof_config.proto
804
805// Begin of protos/perfetto/common/perf_events.proto
806
807message PerfEvents {
808  // What event to sample on, and how often. Commented from the perspective of
809  // its use in |PerfEventConfig|.
810  message Timebase {
811    // How often the per-cpu sampling will occur. Not guaranteed to be honored
812    // as the kernel can throttle the sampling rate if it's too high.
813    // If unset, an implementation-defined default is used.
814    oneof interval {
815      // Per-cpu sampling frequency in Hz, as requested from the kernel. Not the
816      // same as 1/period.
817      // Details: the actual sampling will still be based on a period, but the
818      // kernel will dynamically adjust it based on the observed event rate, to
819      // approximate this frequency. Works best with steady-rate events like
820      // timers.
821      uint64 frequency = 2;
822
823      // Per-cpu sampling will occur every |period| counts of |event|.
824      // Prefer |frequency| by default, as it's easier to oversample with a
825      // fixed period.
826      uint64 period = 1;
827    }
828
829    // Counting event to use as a timebase for the sampling.
830    // If unset, implies the CPU timer (SW_CPU_CLOCK) as the event,
831    // which is what you usually want.
832    // See common/perf_events.proto for the definitions.
833    oneof event {
834      Counter counter = 4;
835      Tracepoint tracepoint = 3;
836    }
837  }
838
839  enum Counter {
840    UNKNOWN_COUNTER = 0;
841    // software:
842    SW_CPU_CLOCK = 1;
843    SW_PAGE_FAULTS = 2;
844    // hardware:
845    HW_CPU_CYCLES = 10;
846    HW_INSTRUCTIONS = 11;
847  }
848
849  message Tracepoint {
850    // Group and name for the tracepoint, acceptable forms:
851    // * "sched/sched_switch"
852    // * "sched:sched_switch"
853    optional string name = 1;
854
855    // Optional field-level filter for the tracepoint. Only events matching this
856    // filter will be counted (and therefore contribute to the sampling period).
857    // Example: "prev_pid >= 42 && next_pid == 0".
858    // For full syntax, see kernel documentation on "Event filtering":
859    // https://www.kernel.org/doc/Documentation/trace/events.txt
860    optional string filter = 2;
861  }
862}
863
864// End of protos/perfetto/common/perf_events.proto
865
866// Begin of protos/perfetto/config/profiling/perf_event_config.proto
867
868// Configuration for the traced_perf profiler.
869//
870// Example config for basic cpu profiling:
871//   perf_event_config {
872//     timebase {
873//       frequency: 80
874//     }
875//     callstack_sampling {
876//       scope {
877//         target_cmdline: "surfaceflinger"
878//         target_cmdline: "system_server"
879//       }
880//       kernel_frames: true
881//     }
882//   }
883//
884// Next id: 19
885message PerfEventConfig {
886  // What event to sample on, and how often.
887  // Defined in common/perf_events.proto.
888  optional PerfEvents.Timebase timebase = 15;
889
890  // If set, the profiler will sample userspace processes' callstacks at the
891  // interval specified by the |timebase|.
892  // If unset, the profiler will record only the event counts.
893  optional CallstackSampling callstack_sampling = 16;
894
895  //
896  // Kernel <-> userspace ring buffer options:
897  //
898
899  // How often the per-cpu ring buffers are read by the producer.
900  // If unset, an implementation-defined default is used.
901  optional uint32 ring_buffer_read_period_ms = 8;
902
903  // Size (in 4k pages) of each per-cpu ring buffer that is filled by the
904  // kernel. If set, must be a power of two.
905  // If unset, an implementation-defined default is used.
906  optional uint32 ring_buffer_pages = 3;
907
908  //
909  // Daemon's resource usage limits:
910  //
911
912  // Drop samples if the heap memory held by the samples in the unwinder queue
913  // is above the given limit. This counts the memory across all concurrent data
914  // sources (not just this one's), and there is no fairness guarantee - the
915  // whole quota might be used up by a concurrent source.
916  optional uint64 max_enqueued_footprint_kb = 17;
917
918  // Stop the data source if traced_perf's combined {RssAnon + Swap} memory
919  // footprint exceeds this value.
920  optional uint32 max_daemon_memory_kb = 13;
921
922  //
923  // Uncommon options:
924  //
925
926  // Timeout for the remote /proc/<pid>/{maps,mem} file descriptors for a
927  // sampled process. This is primarily for Android, where this lookup is
928  // asynchronous. As long as the producer is waiting, the associated samples
929  // will be kept enqueued (putting pressure on the capacity of the shared
930  // unwinding queue). Once a lookup for a process expires, all associated
931  // samples are discarded. However, if the lookup still succeeds after the
932  // timeout, future samples will be handled normally.
933  // If unset, an implementation-defined default is used.
934  optional uint32 remote_descriptor_timeout_ms = 9;
935
936  // Optional period for clearing state cached by the unwinder. This is a heavy
937  // operation that is only necessary for traces that target a wide set of
938  // processes, and require the memory footprint to be reset periodically.
939  // If unset, the cached state will not be cleared.
940  optional uint32 unwind_state_clear_period_ms = 10;
941
942  //
943  // Deprecated (superseded by options above):
944  //
945  // Do not set *any* of these fields in new configs.
946  //
947
948  // Note: legacy configs had to set |all_cpus| to true to pass parsing.
949  // We rely on this to detect such configs.
950  optional bool all_cpus = 1;
951  optional uint32 sampling_frequency = 2;
952  optional bool kernel_frames = 12;
953  repeated int32 target_pid = 4;
954  repeated string target_cmdline = 5;
955
956  // Only profile target if it was installed by one of the packages given.
957  // Special values are:
958  // * @system: installed on the system partition
959  // * @product: installed on the product partition
960  // * @null: sideloaded
961  // Supported on Android 12+.
962  repeated string target_installed_by = 18;
963  repeated int32 exclude_pid = 6;
964  repeated string exclude_cmdline = 7;
965  optional uint32 additional_cmdline_count = 11;
966  // previously |tracepoint|
967  reserved 14;
968
969  //
970  // Sub-messages (nested for generated code namespacing).
971  //
972
973  message CallstackSampling {
974    // Defines a set of processes for which samples are retained/skipped. If
975    // unset, all userspace samples are kept, but beware that it will be very
976    // heavy on the stack unwinder, which might start dropping samples due to
977    // overload.
978    optional Scope scope = 1;
979
980    // If true, callstacks will include the kernel-space frames. Such frames can
981    // be identified by a magical "kernel" string as their mapping name.
982    // Requires traced_perf to be running as root, or kptr_restrict to have been
983    // manually unrestricted. On Android, the platform should do the right thing
984    // on debug builds.
985    // This does *not* disclose KASLR, as only the function names are emitted.
986    optional bool kernel_frames = 2;
987  }
988
989  message Scope {
990    // Process ID (TGID) allowlist. If this list is not empty, only matching
991    // samples will be retained. If multiple allow/deny-lists are
992    // specified by the config, then all of them are evaluated for each sampled
993    // process.
994    repeated int32 target_pid = 1;
995
996    // Command line allowlist, matched against the
997    // /proc/<pid>/cmdline (not the comm string), with both sides being
998    // "normalized". Normalization is as follows: (1) trim everything beyond the
999    // first null or "@" byte; (2) if the string contains forward slashes, trim
1000    // everything up to and including the last one.
1001    repeated string target_cmdline = 2;
1002
1003    // List of excluded pids.
1004    repeated int32 exclude_pid = 3;
1005
1006    // List of excluded cmdlines. Normalized in the same way as
1007    // |target_cmdline|.
1008    repeated string exclude_cmdline = 4;
1009
1010    // Number of additional command lines to sample. Only those which are
1011    // neither explicitly included nor excluded will be considered. Processes
1012    // are accepted on a first come, first served basis.
1013    optional uint32 additional_cmdline_count = 5;
1014  }
1015}
1016
1017// End of protos/perfetto/config/profiling/perf_event_config.proto
1018
1019// Begin of protos/perfetto/common/sys_stats_counters.proto
1020
1021// When editing entries here remember also to update "sys_stats_counters.h" with
1022// the corresponding string definitions for the actual /proc files parser.
1023
1024// Counter definitions for Linux's /proc/meminfo.
1025enum MeminfoCounters {
1026  MEMINFO_UNSPECIFIED = 0;
1027  MEMINFO_MEM_TOTAL = 1;
1028  MEMINFO_MEM_FREE = 2;
1029  MEMINFO_MEM_AVAILABLE = 3;
1030  MEMINFO_BUFFERS = 4;
1031  MEMINFO_CACHED = 5;
1032  MEMINFO_SWAP_CACHED = 6;
1033  MEMINFO_ACTIVE = 7;
1034  MEMINFO_INACTIVE = 8;
1035  MEMINFO_ACTIVE_ANON = 9;
1036  MEMINFO_INACTIVE_ANON = 10;
1037  MEMINFO_ACTIVE_FILE = 11;
1038  MEMINFO_INACTIVE_FILE = 12;
1039  MEMINFO_UNEVICTABLE = 13;
1040  MEMINFO_MLOCKED = 14;
1041  MEMINFO_SWAP_TOTAL = 15;
1042  MEMINFO_SWAP_FREE = 16;
1043  MEMINFO_DIRTY = 17;
1044  MEMINFO_WRITEBACK = 18;
1045  MEMINFO_ANON_PAGES = 19;
1046  MEMINFO_MAPPED = 20;
1047  MEMINFO_SHMEM = 21;
1048  MEMINFO_SLAB = 22;
1049  MEMINFO_SLAB_RECLAIMABLE = 23;
1050  MEMINFO_SLAB_UNRECLAIMABLE = 24;
1051  MEMINFO_KERNEL_STACK = 25;
1052  MEMINFO_PAGE_TABLES = 26;
1053  MEMINFO_COMMIT_LIMIT = 27;
1054  MEMINFO_COMMITED_AS = 28;
1055  MEMINFO_VMALLOC_TOTAL = 29;
1056  MEMINFO_VMALLOC_USED = 30;
1057  MEMINFO_VMALLOC_CHUNK = 31;
1058  MEMINFO_CMA_TOTAL = 32;
1059  MEMINFO_CMA_FREE = 33;
1060}
1061
1062// Counter definitions for Linux's /proc/vmstat.
1063enum VmstatCounters {
1064  VMSTAT_UNSPECIFIED = 0;
1065  VMSTAT_NR_FREE_PAGES = 1;
1066  VMSTAT_NR_ALLOC_BATCH = 2;
1067  VMSTAT_NR_INACTIVE_ANON = 3;
1068  VMSTAT_NR_ACTIVE_ANON = 4;
1069  VMSTAT_NR_INACTIVE_FILE = 5;
1070  VMSTAT_NR_ACTIVE_FILE = 6;
1071  VMSTAT_NR_UNEVICTABLE = 7;
1072  VMSTAT_NR_MLOCK = 8;
1073  VMSTAT_NR_ANON_PAGES = 9;
1074  VMSTAT_NR_MAPPED = 10;
1075  VMSTAT_NR_FILE_PAGES = 11;
1076  VMSTAT_NR_DIRTY = 12;
1077  VMSTAT_NR_WRITEBACK = 13;
1078  VMSTAT_NR_SLAB_RECLAIMABLE = 14;
1079  VMSTAT_NR_SLAB_UNRECLAIMABLE = 15;
1080  VMSTAT_NR_PAGE_TABLE_PAGES = 16;
1081  VMSTAT_NR_KERNEL_STACK = 17;
1082  VMSTAT_NR_OVERHEAD = 18;
1083  VMSTAT_NR_UNSTABLE = 19;
1084  VMSTAT_NR_BOUNCE = 20;
1085  VMSTAT_NR_VMSCAN_WRITE = 21;
1086  VMSTAT_NR_VMSCAN_IMMEDIATE_RECLAIM = 22;
1087  VMSTAT_NR_WRITEBACK_TEMP = 23;
1088  VMSTAT_NR_ISOLATED_ANON = 24;
1089  VMSTAT_NR_ISOLATED_FILE = 25;
1090  VMSTAT_NR_SHMEM = 26;
1091  VMSTAT_NR_DIRTIED = 27;
1092  VMSTAT_NR_WRITTEN = 28;
1093  VMSTAT_NR_PAGES_SCANNED = 29;
1094  VMSTAT_WORKINGSET_REFAULT = 30;
1095  VMSTAT_WORKINGSET_ACTIVATE = 31;
1096  VMSTAT_WORKINGSET_NODERECLAIM = 32;
1097  VMSTAT_NR_ANON_TRANSPARENT_HUGEPAGES = 33;
1098  VMSTAT_NR_FREE_CMA = 34;
1099  VMSTAT_NR_SWAPCACHE = 35;
1100  VMSTAT_NR_DIRTY_THRESHOLD = 36;
1101  VMSTAT_NR_DIRTY_BACKGROUND_THRESHOLD = 37;
1102  VMSTAT_PGPGIN = 38;
1103  VMSTAT_PGPGOUT = 39;
1104  VMSTAT_PGPGOUTCLEAN = 40;
1105  VMSTAT_PSWPIN = 41;
1106  VMSTAT_PSWPOUT = 42;
1107  VMSTAT_PGALLOC_DMA = 43;
1108  VMSTAT_PGALLOC_NORMAL = 44;
1109  VMSTAT_PGALLOC_MOVABLE = 45;
1110  VMSTAT_PGFREE = 46;
1111  VMSTAT_PGACTIVATE = 47;
1112  VMSTAT_PGDEACTIVATE = 48;
1113  VMSTAT_PGFAULT = 49;
1114  VMSTAT_PGMAJFAULT = 50;
1115  VMSTAT_PGREFILL_DMA = 51;
1116  VMSTAT_PGREFILL_NORMAL = 52;
1117  VMSTAT_PGREFILL_MOVABLE = 53;
1118  VMSTAT_PGSTEAL_KSWAPD_DMA = 54;
1119  VMSTAT_PGSTEAL_KSWAPD_NORMAL = 55;
1120  VMSTAT_PGSTEAL_KSWAPD_MOVABLE = 56;
1121  VMSTAT_PGSTEAL_DIRECT_DMA = 57;
1122  VMSTAT_PGSTEAL_DIRECT_NORMAL = 58;
1123  VMSTAT_PGSTEAL_DIRECT_MOVABLE = 59;
1124  VMSTAT_PGSCAN_KSWAPD_DMA = 60;
1125  VMSTAT_PGSCAN_KSWAPD_NORMAL = 61;
1126  VMSTAT_PGSCAN_KSWAPD_MOVABLE = 62;
1127  VMSTAT_PGSCAN_DIRECT_DMA = 63;
1128  VMSTAT_PGSCAN_DIRECT_NORMAL = 64;
1129  VMSTAT_PGSCAN_DIRECT_MOVABLE = 65;
1130  VMSTAT_PGSCAN_DIRECT_THROTTLE = 66;
1131  VMSTAT_PGINODESTEAL = 67;
1132  VMSTAT_SLABS_SCANNED = 68;
1133  VMSTAT_KSWAPD_INODESTEAL = 69;
1134  VMSTAT_KSWAPD_LOW_WMARK_HIT_QUICKLY = 70;
1135  VMSTAT_KSWAPD_HIGH_WMARK_HIT_QUICKLY = 71;
1136  VMSTAT_PAGEOUTRUN = 72;
1137  VMSTAT_ALLOCSTALL = 73;
1138  VMSTAT_PGROTATED = 74;
1139  VMSTAT_DROP_PAGECACHE = 75;
1140  VMSTAT_DROP_SLAB = 76;
1141  VMSTAT_PGMIGRATE_SUCCESS = 77;
1142  VMSTAT_PGMIGRATE_FAIL = 78;
1143  VMSTAT_COMPACT_MIGRATE_SCANNED = 79;
1144  VMSTAT_COMPACT_FREE_SCANNED = 80;
1145  VMSTAT_COMPACT_ISOLATED = 81;
1146  VMSTAT_COMPACT_STALL = 82;
1147  VMSTAT_COMPACT_FAIL = 83;
1148  VMSTAT_COMPACT_SUCCESS = 84;
1149  VMSTAT_COMPACT_DAEMON_WAKE = 85;
1150  VMSTAT_UNEVICTABLE_PGS_CULLED = 86;
1151  VMSTAT_UNEVICTABLE_PGS_SCANNED = 87;
1152  VMSTAT_UNEVICTABLE_PGS_RESCUED = 88;
1153  VMSTAT_UNEVICTABLE_PGS_MLOCKED = 89;
1154  VMSTAT_UNEVICTABLE_PGS_MUNLOCKED = 90;
1155  VMSTAT_UNEVICTABLE_PGS_CLEARED = 91;
1156  VMSTAT_UNEVICTABLE_PGS_STRANDED = 92;
1157  VMSTAT_NR_ZSPAGES = 93;
1158  VMSTAT_NR_ION_HEAP = 94;
1159  VMSTAT_NR_GPU_HEAP = 95;
1160  VMSTAT_ALLOCSTALL_DMA = 96;
1161  VMSTAT_ALLOCSTALL_MOVABLE = 97;
1162  VMSTAT_ALLOCSTALL_NORMAL = 98;
1163  VMSTAT_COMPACT_DAEMON_FREE_SCANNED = 99;
1164  VMSTAT_COMPACT_DAEMON_MIGRATE_SCANNED = 100;
1165  VMSTAT_NR_FASTRPC = 101;
1166  VMSTAT_NR_INDIRECTLY_RECLAIMABLE = 102;
1167  VMSTAT_NR_ION_HEAP_POOL = 103;
1168  VMSTAT_NR_KERNEL_MISC_RECLAIMABLE = 104;
1169  VMSTAT_NR_SHADOW_CALL_STACK_BYTES = 105;
1170  VMSTAT_NR_SHMEM_HUGEPAGES = 106;
1171  VMSTAT_NR_SHMEM_PMDMAPPED = 107;
1172  VMSTAT_NR_UNRECLAIMABLE_PAGES = 108;
1173  VMSTAT_NR_ZONE_ACTIVE_ANON = 109;
1174  VMSTAT_NR_ZONE_ACTIVE_FILE = 110;
1175  VMSTAT_NR_ZONE_INACTIVE_ANON = 111;
1176  VMSTAT_NR_ZONE_INACTIVE_FILE = 112;
1177  VMSTAT_NR_ZONE_UNEVICTABLE = 113;
1178  VMSTAT_NR_ZONE_WRITE_PENDING = 114;
1179  VMSTAT_OOM_KILL = 115;
1180  VMSTAT_PGLAZYFREE = 116;
1181  VMSTAT_PGLAZYFREED = 117;
1182  VMSTAT_PGREFILL = 118;
1183  VMSTAT_PGSCAN_DIRECT = 119;
1184  VMSTAT_PGSCAN_KSWAPD = 120;
1185  VMSTAT_PGSKIP_DMA = 121;
1186  VMSTAT_PGSKIP_MOVABLE = 122;
1187  VMSTAT_PGSKIP_NORMAL = 123;
1188  VMSTAT_PGSTEAL_DIRECT = 124;
1189  VMSTAT_PGSTEAL_KSWAPD = 125;
1190  VMSTAT_SWAP_RA = 126;
1191  VMSTAT_SWAP_RA_HIT = 127;
1192  VMSTAT_WORKINGSET_RESTORE = 128;
1193}
1194// End of protos/perfetto/common/sys_stats_counters.proto
1195
1196// Begin of protos/perfetto/config/sys_stats/sys_stats_config.proto
1197
1198// This file defines the configuration for the Linux /proc poller data source,
1199// which injects counters in the trace.
1200// Counters that are needed in the trace must be explicitly listed in the
1201// *_counters fields. This is to avoid spamming the trace with all counters
1202// at all times.
1203// The sampling rate is configurable. All polling rates (*_period_ms) need
1204// to be integer multiples of each other.
1205// OK:     [10ms, 10ms, 10ms],  [10ms, 20ms, 10ms],  [10ms, 20ms, 60ms]
1206// Not OK: [10ms, 10ms, 11ms],  [10ms, 15ms, 20ms]
1207message SysStatsConfig {
1208  // Polls /proc/meminfo every X ms, if non-zero.
1209  // This is required to be > 10ms to avoid excessive CPU usage.
1210  // Cost: 0.3 ms [read] + 0.07 ms [parse + trace injection]
1211  optional uint32 meminfo_period_ms = 1;
1212
1213  // If empty all known counters are reported. Otherwise, only the counters
1214  // specified below are reported.
1215  repeated MeminfoCounters meminfo_counters = 2;
1216
1217  // Polls /proc/vmstat every X ms, if non-zero.
1218  // This is required to be > 10ms to avoid excessive CPU usage.
1219  // Cost: 0.2 ms [read] + 0.3 ms [parse + trace injection]
1220  optional uint32 vmstat_period_ms = 3;
1221  repeated VmstatCounters vmstat_counters = 4;
1222
1223  // Pols /proc/stat every X ms, if non-zero.
1224  // This is required to be > 10ms to avoid excessive CPU usage.
1225  // Cost: 4.1 ms [read] + 1.9 ms [parse + trace injection]
1226  optional uint32 stat_period_ms = 5;
1227  enum StatCounters {
1228    STAT_UNSPECIFIED = 0;
1229    STAT_CPU_TIMES = 1;
1230    STAT_IRQ_COUNTS = 2;
1231    STAT_SOFTIRQ_COUNTS = 3;
1232    STAT_FORK_COUNT = 4;
1233  }
1234  repeated StatCounters stat_counters = 6;
1235
1236  // Polls /sys/devfreq/*/curfreq every X ms, if non-zero.
1237  // This is required to be > 10ms to avoid excessive CPU usage.
1238  // This option can be used to record unchanging values.
1239  // Updates from frequency changes can come from ftrace/set_clock_rate.
1240  optional uint32 devfreq_period_ms = 7;
1241}
1242
1243// End of protos/perfetto/config/sys_stats/sys_stats_config.proto
1244
1245// Begin of protos/perfetto/config/test_config.proto
1246
1247// The configuration for a fake producer used in tests.
1248message TestConfig {
1249  message DummyFields {
1250    optional uint32 field_uint32 = 1;
1251    optional int32 field_int32 = 2;
1252    optional uint64 field_uint64 = 3;
1253    optional int64 field_int64 = 4;
1254    optional fixed64 field_fixed64 = 5;
1255    optional sfixed64 field_sfixed64 = 6;
1256    optional fixed32 field_fixed32 = 7;
1257    optional sfixed32 field_sfixed32 = 8;
1258    optional double field_double = 9;
1259    optional float field_float = 10;
1260    optional sint64 field_sint64 = 11;
1261    optional sint32 field_sint32 = 12;
1262    optional string field_string = 13;
1263    optional bytes field_bytes = 14;
1264  }
1265
1266  // The number of messages the fake producer should send.
1267  optional uint32 message_count = 1;
1268
1269  // The maximum number of messages which should be sent each second.
1270  // The actual obserced speed may be lower if the producer is unable to
1271  // work fast enough.
1272  // If this is zero or unset, the producer will send as fast as possible.
1273  optional uint32 max_messages_per_second = 2;
1274
1275  // The seed value for a simple multiplicative congruential pseudo-random
1276  // number sequence.
1277  optional uint32 seed = 3;
1278
1279  // The size of each message in bytes. Should be greater than or equal 5 to
1280  // account for the number of bytes needed to encode the random number and a
1281  // null byte for the string.
1282  optional uint32 message_size = 4;
1283
1284  // Whether the producer should send a event batch when the data source is
1285  // is initially registered.
1286  optional bool send_batch_on_register = 5;
1287
1288  optional DummyFields dummy_fields = 6;
1289}
1290
1291// End of protos/perfetto/config/test_config.proto
1292
1293// Begin of protos/perfetto/config/track_event/track_event_config.proto
1294
1295message TrackEventConfig {
1296  // The following fields define the set of enabled trace categories. Each list
1297  // item is a glob.
1298  //
1299  // To determine if category is enabled, it is checked against the filters in
1300  // the following order:
1301  //
1302  //   1. Exact matches in enabled categories.
1303  //   2. Exact matches in enabled tags.
1304  //   3. Exact matches in disabled categories.
1305  //   4. Exact matches in disabled tags.
1306  //   5. Pattern matches in enabled categories.
1307  //   6. Pattern matches in enabled tags.
1308  //   7. Pattern matches in disabled categories.
1309  //   8. Pattern matches in disabled tags.
1310  //
1311  // If none of the steps produced a match, the category is enabled by default.
1312  //
1313  // Examples:
1314  //
1315  //  - To enable all non-slow/debug categories:
1316  //
1317  //       No configuration needed, happens by default.
1318  //
1319  //  - To enable a specific category:
1320  //
1321  //       disabled_categories = ["*"]
1322  //       enabled_categories = ["my_category"]
1323  //
1324  //  - To enable only categories with a specific tag:
1325  //
1326  //       disabled_tags = ["*"]
1327  //       enabled_tags = ["my_tag"]
1328  //
1329
1330  // Default: []
1331  repeated string disabled_categories = 1;
1332
1333  // Default: []
1334  repeated string enabled_categories = 2;
1335
1336  // Default: [“slow”, “debug”]
1337  repeated string disabled_tags = 3;
1338
1339  // Default: []
1340  repeated string enabled_tags = 4;
1341}
1342
1343// End of protos/perfetto/config/track_event/track_event_config.proto
1344
1345// Begin of protos/perfetto/config/data_source_config.proto
1346
1347// The configuration that is passed to each data source when starting tracing.
1348// Next id: 116
1349message DataSourceConfig {
1350  enum SessionInitiator {
1351    SESSION_INITIATOR_UNSPECIFIED = 0;
1352    // This trace was initiated from a trusted system app has DUMP and
1353    // USAGE_STATS permission. This system app is expected to not expose the
1354    // trace to the user of the device.
1355    // This is determined by checking the UID initiating the trace.
1356    SESSION_INITIATOR_TRUSTED_SYSTEM = 1;
1357  };
1358  // Data source unique name, e.g., "linux.ftrace". This must match
1359  // the name passed by the data source when it registers (see
1360  // RegisterDataSource()).
1361  optional string name = 1;
1362
1363  // The index of the logging buffer where TracePacket(s) will be stored.
1364  // This field doesn't make a major difference for the Producer(s). The final
1365  // logging buffers, in fact, are completely owned by the Service. We just ask
1366  // the Producer to copy this number into the chunk headers it emits, so that
1367  // the Service can quickly identify the buffer where to move the chunks into
1368  // without expensive lookups on its fastpath.
1369  optional uint32 target_buffer = 2;
1370
1371  // Set by the service to indicate the duration of the trace.
1372  // DO NOT SET in consumer as this will be overridden by the service.
1373  optional uint32 trace_duration_ms = 3;
1374
1375  // Set by the service to indicate how long it waits after StopDataSource.
1376  // DO NOT SET in consumer as this will be overridden by the service.
1377  optional uint32 stop_timeout_ms = 7;
1378
1379  // Set by the service to indicate whether this tracing session has extra
1380  // guardrails.
1381  // DO NOT SET in consumer as this will be overridden by the service.
1382  optional bool enable_extra_guardrails = 6;
1383
1384  // Set by the service to indicate which user initiated this trace.
1385  // DO NOT SET in consumer as this will be overridden by the service.
1386  optional SessionInitiator session_initiator = 8;
1387
1388  // Set by the service to indicate which tracing session the data source
1389  // belongs to. The intended use case for this is checking if two data sources,
1390  // one of which produces metadata for the other one, belong to the same trace
1391  // session and hence should be linked together.
1392  // This field was introduced in Aug 2018 after Android P.
1393  // DO NOT SET in consumer as this will be overridden by the service.
1394  optional uint64 tracing_session_id = 4;
1395
1396  // Keeep the lower IDs (up to 99) for fields that are *not* specific to
1397  // data-sources and needs to be processed by the traced daemon.
1398
1399  // All data source config fields must be marked as [lazy=true]. This prevents
1400  // the proto-to-cpp generator from recursing into those when generating the
1401  // cpp classes and polluting tracing/core with data-source-specific classes.
1402  // Instead they are treated as opaque strings containing raw proto bytes.
1403
1404  // Data source name: linux.ftrace
1405  optional FtraceConfig ftrace_config = 100 [lazy = true];
1406  // Data source name: linux.inode_file_map
1407  optional InodeFileConfig inode_file_config = 102 [lazy = true];
1408  // Data source name: linux.process_stats
1409  optional ProcessStatsConfig process_stats_config = 103 [lazy = true];
1410  // Data source name: linux.sys_stats
1411  optional SysStatsConfig sys_stats_config = 104 [lazy = true];
1412  // Data source name: android.heapprofd
1413  // Introduced in Android 10.
1414  optional HeapprofdConfig heapprofd_config = 105 [lazy = true];
1415  // Data source name: android.java_hprof
1416  // Introduced in Android 11.
1417  optional JavaHprofConfig java_hprof_config = 110 [lazy = true];
1418  // Data source name: android.power
1419  optional AndroidPowerConfig android_power_config = 106 [lazy = true];
1420  // Data source name: android.log
1421  optional AndroidLogConfig android_log_config = 107 [lazy = true];
1422  // TODO(fmayer): Add data source name for this.
1423  optional GpuCounterConfig gpu_counter_config = 108 [lazy = true];
1424  // Data source name: android.packages_list
1425  optional PackagesListConfig packages_list_config = 109 [lazy = true];
1426  // Data source name: linux.perf
1427  optional PerfEventConfig perf_event_config = 111 [lazy = true];
1428  // Data source name: vulkan.memory_tracker
1429  optional VulkanMemoryConfig vulkan_memory_config = 112 [lazy = true];
1430  // Data source name: track_event
1431  optional TrackEventConfig track_event_config = 113 [lazy = true];
1432  // Data source name: android.polled_state
1433  optional AndroidPolledStateConfig android_polled_state_config = 114
1434      [lazy = true];
1435
1436  // Chrome is special as it doesn't use the perfetto IPC layer. We want to
1437  // avoid proto serialization and de-serialization there because that would
1438  // just add extra hops on top of the Mojo ser/des. Instead we auto-generate a
1439  // C++ class for it so it can pass around plain C++ objets.
1440  optional ChromeConfig chrome_config = 101;
1441
1442  // If an interceptor is specified here, packets for this data source will be
1443  // rerouted to the interceptor instead of the main trace buffer. This can be
1444  // used, for example, to write trace data into ETW or for logging trace points
1445  // to the console.
1446  //
1447  // Note that interceptors are only supported by data sources registered
1448  // through the Perfetto SDK API. Data sources that don't use that API (e.g.,
1449  // traced_probes) may not support interception.
1450  optional InterceptorConfig interceptor_config = 115;
1451
1452  // This is a fallback mechanism to send a free-form text config to the
1453  // producer. In theory this should never be needed. All the code that
1454  // is part of the platform (i.e. traced service) is supposed to *not* truncate
1455  // the trace config proto and propagate unknown fields. However, if anything
1456  // in the pipeline (client or backend) ends up breaking this forward compat
1457  // plan, this field will become the escape hatch to allow future data sources
1458  // to get some meaningful configuration.
1459  optional string legacy_config = 1000;
1460
1461  // This field is only used for testing.
1462  optional TestConfig for_testing = 1001;
1463
1464  // Was |for_testing|. Caused more problems then found.
1465  reserved 268435455;
1466}
1467
1468// End of protos/perfetto/config/data_source_config.proto
1469
1470// Begin of protos/perfetto/config/trace_config.proto
1471
1472// The overall config that is used when starting a new tracing session through
1473// ProducerPort::StartTracing().
1474// It contains the general config for the logging buffer(s) and the configs for
1475// all the data source being enabled.
1476//
1477// Next id: 33.
1478message TraceConfig {
1479  message BufferConfig {
1480    optional uint32 size_kb = 1;
1481
1482    // |page_size|, now deprecated.
1483    reserved 2;
1484
1485    // |optimize_for|, now deprecated.
1486    reserved 3;
1487
1488    enum FillPolicy {
1489      UNSPECIFIED = 0;
1490
1491      // Default behavior. The buffer operates as a conventional ring buffer.
1492      // If the writer is faster than the reader (or if the reader reads only
1493      // after tracing is stopped) newly written packets will overwrite old
1494      // packets.
1495      RING_BUFFER = 1;
1496
1497      // Behaves like RING_BUFFER as long as there is space in the buffer or
1498      // the reader catches up with the writer. As soon as the writer hits
1499      // an unread chunk, it stops accepting new data in the buffer.
1500      DISCARD = 2;
1501    }
1502    optional FillPolicy fill_policy = 4;
1503  }
1504  repeated BufferConfig buffers = 1;
1505
1506  message DataSource {
1507    // Filters and data-source specific config. It contains also the unique name
1508    // of the data source, the one passed in the  DataSourceDescriptor when they
1509    // register on the service.
1510    optional protos.DataSourceConfig config = 1;
1511
1512    // Optional. If multiple producers (~processes) expose the same data source
1513    // and either |producer_name_filter| or |producer_name_regex_filter| is set,
1514    // the data source is enabled only for producers whose names match any of
1515    // the filters.
1516    // |producer_name_filter| has to be an exact match, while
1517    // |producer_name_regex_filter| is a regular expression.
1518    // This allows to enable a data source only for specific processes.
1519    // The "repeated" fields have OR semantics: specifying a filter ["foo",
1520    // "bar"] will enable data sources on both "foo" and "bar" (if they exist).
1521    repeated string producer_name_filter = 2;
1522    repeated string producer_name_regex_filter = 3;
1523  }
1524  repeated DataSource data_sources = 2;
1525
1526  // Config for disabling builtin data sources in the tracing service.
1527  message BuiltinDataSource {
1528    // Disable emitting clock timestamps into the trace.
1529    optional bool disable_clock_snapshotting = 1;
1530
1531    // Disable echoing the original trace config in the trace.
1532    optional bool disable_trace_config = 2;
1533
1534    // Disable emitting system info (build fingerprint, cpuinfo, etc).
1535    optional bool disable_system_info = 3;
1536
1537    // Disable emitting events for data-source state changes (e.g. the marker
1538    // for all data sources having ACKed the start of the trace).
1539    optional bool disable_service_events = 4;
1540
1541    // The authoritative clock domain for the trace. Defaults to BOOTTIME. See
1542    // also ClockSnapshot's primary_trace_clock. The configured value is written
1543    // into the trace as part of the ClockSnapshots emitted by the service.
1544    // Trace processor will attempt to translate packet/event timestamps from
1545    // various data sources (and their chosen clock domains) to this domain
1546    // during import. Added in Android R.
1547    optional BuiltinClock primary_trace_clock = 5;
1548
1549    // Time interval in between snapshotting of sync markers, clock snapshots,
1550    // stats, and other periodic service-emitted events. Note that the service
1551    // only keeps track of the first and the most recent snapshot until
1552    // ReadBuffers() is called.
1553    optional uint32 snapshot_interval_ms = 6;
1554
1555    // Hints to the service that a suspend-aware (i.e. counting time in suspend)
1556    // clock should be used for periodic snapshots of service-emitted events.
1557    // This means, if a snapshot *should* have happened during suspend, it will
1558    // happen immediately after the device resumes.
1559    //
1560    // Choosing a clock like this is done on best-effort basis; not all
1561    // platforms (e.g. Windows) expose a clock which can be used for periodic
1562    // tasks counting suspend. If such a clock is not available, the service
1563    // falls back to the best-available alternative.
1564    //
1565    // Introduced in Android S.
1566    // TODO(lalitm): deprecate this in T and make this the default if nothing
1567    // crashes in S.
1568    optional bool prefer_suspend_clock_for_snapshot = 7;
1569  }
1570  optional BuiltinDataSource builtin_data_sources = 20;
1571
1572  // If specified, the trace will be stopped |duration_ms| after starting.
1573  // This does *not* count the time the system is suspended, so we will run
1574  // for duration_ms of system activity, not wall time.
1575  //
1576  // However in case of traces with triggers, see
1577  // TriggerConfig.trigger_timeout_ms instead.
1578  optional uint32 duration_ms = 3;
1579
1580  // This is set when --dropbox is passed to the Perfetto command line client
1581  // and enables guardrails that limit resource usage for traces requested
1582  // by statsd.
1583  optional bool enable_extra_guardrails = 4;
1584
1585  enum LockdownModeOperation {
1586    LOCKDOWN_UNCHANGED = 0;
1587    LOCKDOWN_CLEAR = 1;
1588    LOCKDOWN_SET = 2;
1589  }
1590  // Reject producers that are not running under the same UID as the tracing
1591  // service.
1592  optional LockdownModeOperation lockdown_mode = 5;
1593
1594  message ProducerConfig {
1595    // Identifies the producer for which this config is for.
1596    optional string producer_name = 1;
1597
1598    // Specifies the preferred size of the shared memory buffer. If the size is
1599    // larger than the max size, the max will be used. If it is smaller than
1600    // the page size or doesn't fit pages evenly into it, it will fall back to
1601    // the size specified by the producer or finally the default shared memory
1602    // size.
1603    optional uint32 shm_size_kb = 2;
1604
1605    // Specifies the preferred size of each page in the shared memory buffer.
1606    // Must be an integer multiple of 4K.
1607    optional uint32 page_size_kb = 3;
1608  }
1609
1610  repeated ProducerConfig producers = 6;
1611
1612  // Contains statsd-specific metadata about an alert associated with the trace.
1613  message StatsdMetadata {
1614    // The identifier of the alert which triggered this trace.
1615    optional int64 triggering_alert_id = 1;
1616    // The uid which registered the triggering configuration with statsd.
1617    optional int32 triggering_config_uid = 2;
1618    // The identifier of the config which triggered the alert.
1619    optional int64 triggering_config_id = 3;
1620    // The identifier of the subscription which triggered this trace.
1621    optional int64 triggering_subscription_id = 4;
1622  }
1623
1624  // Statsd-specific metadata.
1625  optional StatsdMetadata statsd_metadata = 7;
1626
1627  // When true && |output_path| is empty, the EnableTracing() request must
1628  // provide a file descriptor. The service will then periodically read packets
1629  // out of the trace buffer and store it into the passed file.
1630  // If |output_path| is not empty no fd should be passed, the service
1631  // will create a new file and write into that (see comment below).
1632  optional bool write_into_file = 8;
1633
1634  // This must point to a non-existing file. If the file exists the service
1635  // will NOT overwrite and will fail instead as a security precaution.
1636  // On Android, when this is used with the system traced, the path must be
1637  // within /data/misc/perfetto-traces/ or the trace will fail.
1638  // This option has been introduced in Android R. Before R write_into_file
1639  // can be used only with the "pass a file descriptor over IPC" mode.
1640  optional string output_path = 29;
1641
1642  // Optional. If non-zero tunes the write period. A min value of 100ms is
1643  // enforced (i.e. smaller values are ignored).
1644  optional uint32 file_write_period_ms = 9;
1645
1646  // Optional. When non zero the periodic write stops once at most X bytes
1647  // have been written into the file. Tracing is disabled when this limit is
1648  // reached, even if |duration_ms| has not been reached yet.
1649  optional uint64 max_file_size_bytes = 10;
1650
1651  // Contains flags which override the default values of the guardrails inside
1652  // Perfetto.
1653  message GuardrailOverrides {
1654    // Override the default limit (in bytes) for uploading data to server within
1655    // a 24 hour period.
1656    // On R-, this override only affected userdebug builds. Since S, it also
1657    // affects user builds.
1658    optional uint64 max_upload_per_day_bytes = 1;
1659  }
1660  optional GuardrailOverrides guardrail_overrides = 11;
1661
1662  // When true, data sources are not started until an explicit call to
1663  // StartTracing() on the consumer port. This is to support early
1664  // initialization and fast trace triggering. This can be used only when the
1665  // Consumer explicitly triggers the StartTracing() method.
1666  // This should not be used in a remote trace config via statsd, doing so will
1667  // result in a hung trace session.
1668  optional bool deferred_start = 12;
1669
1670  // When set, it periodically issues a Flush() to all data source, forcing them
1671  // to commit their data into the tracing service. This can be used for
1672  // quasi-real-time streaming mode and to guarantee some partial ordering of
1673  // events in the trace in windows of X ms.
1674  optional uint32 flush_period_ms = 13;
1675
1676  // Wait for this long for producers to acknowledge flush requests.
1677  // Default 5s.
1678  optional uint32 flush_timeout_ms = 14;
1679
1680  // Wait for this long for producers to acknowledge stop requests.
1681  // Default 5s.
1682  optional uint32 data_source_stop_timeout_ms = 23;
1683
1684  // |disable_clock_snapshotting| moved.
1685  reserved 15;
1686
1687  // Android-only. If set, sends an intent to the Traceur system app when the
1688  // trace ends to notify it about the trace readiness.
1689  optional bool notify_traceur = 16;
1690
1691  // Android-only. If set to a value > 0, marks the trace session as a candidate
1692  // for being attached to a bugreport. This field effectively acts as a z-index
1693  // for bugreports. When Android's dumpstate runs perfetto
1694  // --save-for-bugreport, traced will pick the tracing session with the highest
1695  // score (score <= 0 is ignored), will steal its contents, save the trace into
1696  // a known path and stop prematurely.
1697  // This field was introduced in Android S.
1698  optional int32 bugreport_score = 30;
1699
1700  // Triggers allow producers to start or stop the tracing session when an event
1701  // occurs.
1702  //
1703  // For example if we are tracing probabilistically, most traces will be
1704  // uninteresting. Triggers allow us to keep only the interesting ones such as
1705  // those traces during which the device temperature reached a certain
1706  // threshold. In this case the producer can activate a trigger to keep
1707  // (STOP_TRACING) the trace, otherwise it can also begin a trace
1708  // (START_TRACING) because it knows something is about to happen.
1709  message TriggerConfig {
1710    enum TriggerMode {
1711      UNSPECIFIED = 0;
1712
1713      // When this mode is chosen, data sources are not started until one of the
1714      // |triggers| are received. This supports early initialization and fast
1715      // starting of the tracing system. On triggering, the session will then
1716      // record for |stop_delay_ms|. However if no trigger is seen
1717      // after |trigger_timeout_ms| the session will be stopped and no data will
1718      // be returned.
1719      START_TRACING = 1;
1720
1721      // When this mode is chosen, the session will be started via the normal
1722      // EnableTracing() & StartTracing(). If no trigger is ever seen
1723      // the session will be stopped after |trigger_timeout_ms| and no data will
1724      // be returned. However if triggered the trace will stop after
1725      // |stop_delay_ms| and any data in the buffer will be returned to the
1726      // consumer.
1727      STOP_TRACING = 2;
1728    }
1729    optional TriggerMode trigger_mode = 1;
1730
1731    message Trigger {
1732      // The producer must specify this name to activate the trigger.
1733      optional string name = 1;
1734
1735      // An std::regex that will match the producer that can activate this
1736      // trigger. This is optional. If unset any producers can activate this
1737      // trigger.
1738      optional string producer_name_regex = 2;
1739
1740      // After a trigger is received either in START_TRACING or STOP_TRACING
1741      // mode then the trace will end |stop_delay_ms| after triggering.
1742      optional uint32 stop_delay_ms = 3;
1743
1744      // Limits the number of traces this trigger can start/stop in a rolling
1745      // 24 hour window. If this field is unset or zero, no limit is applied and
1746      // activiation of this trigger *always* starts/stops the trace.
1747      optional uint32 max_per_24_h = 4;
1748
1749      // A value between 0 and 1 which encodes the probability of skipping a
1750      // trigger with this name. This is useful for reducing the probability
1751      // of high-frequency triggers from dominating trace finaization. If this
1752      // field is unset or zero, the trigger will *never* be skipped. If this
1753      // field is greater than or equal to 1, this trigger will *always* be
1754      // skipped i.e. it will be as if this trigger was never included in the
1755      // first place.
1756      // This probability check is applied *before* any other limits. For
1757      // example, if |max_per_24_h| is also set, first we will check if the
1758      // probability bar is met and only then will we check the |max_per_24_h|
1759      // limit.
1760      optional double skip_probability = 5;
1761    }
1762    // A list of triggers which are related to this configuration. If ANY
1763    // trigger is seen then an action will be performed based on |trigger_mode|.
1764    repeated Trigger triggers = 2;
1765
1766    // Required and must be positive if a TriggerConfig is specified. This is
1767    // how long this TraceConfig should wait for a trigger to arrive. After this
1768    // period of time if no trigger is seen the TracingSession will be cleaned
1769    // up.
1770    optional uint32 trigger_timeout_ms = 3;
1771  }
1772  optional TriggerConfig trigger_config = 17;
1773
1774  // When this is non-empty the perfetto command line tool will ignore the rest
1775  // of this TraceConfig and instead connect to the perfetto service as a
1776  // producer and send these triggers, potentially stopping or starting traces
1777  // that were previous configured to use a TriggerConfig.
1778  repeated string activate_triggers = 18;
1779
1780  // Configuration for trace contents that reference earlier trace data. For
1781  // example, a data source might intern strings, and emit packets containing
1782  // {interned id : string} pairs. Future packets from that data source can then
1783  // use the interned ids instead of duplicating the raw string contents. The
1784  // trace parser will then need to use that interning table to fully interpret
1785  // the rest of the trace.
1786  message IncrementalStateConfig {
1787    // If nonzero, notify eligible data sources to clear their incremental state
1788    // periodically, with the given period. The notification is sent only to
1789    // data sources that have |handles_incremental_state_clear| set in their
1790    // DataSourceDescriptor. The notification requests that the data source
1791    // stops referring to past trace contents. This is particularly useful when
1792    // tracing in ring buffer mode, where it is not exceptional to overwrite old
1793    // trace data.
1794    //
1795    // Warning: this time-based global clearing is likely to be removed in the
1796    // future, to be replaced with a smarter way of sending the notifications
1797    // only when necessary.
1798    optional uint32 clear_period_ms = 1;
1799  }
1800  optional IncrementalStateConfig incremental_state_config = 21;
1801
1802  // Additional guardrail used by the Perfetto command line client.
1803  // On user builds when --dropbox is set perfetto will refuse to trace unless
1804  // this is also set.
1805  // Added in Q.
1806  optional bool allow_user_build_tracing = 19;
1807
1808  // If set the tracing service will ensure there is at most one tracing session
1809  // with this key.
1810  optional string unique_session_name = 22;
1811
1812  // Compress trace with the given method. Best effort.
1813  enum CompressionType {
1814    COMPRESSION_TYPE_UNSPECIFIED = 0;
1815    COMPRESSION_TYPE_DEFLATE = 1;
1816  }
1817  optional CompressionType compression_type = 24;
1818
1819  // Android-only. Not for general use. If set, saves the trace into an
1820  // incident. This field is read by perfetto_cmd, rather than the tracing
1821  // service. This field must be set when passing the --upload flag to
1822  // perfetto_cmd.
1823  message IncidentReportConfig {
1824    // In this message, either:
1825    //  * all of |destination_package|, |destination_class| and |privacy_level|
1826    //    must be set.
1827    //  * |skip_incidentd| must be explicitly set to true.
1828
1829    optional string destination_package = 1;
1830    optional string destination_class = 2;
1831    // Level of filtering in the requested incident. See |Destination| in
1832    // frameworks/base/core/proto/android/privacy.proto.
1833    optional int32 privacy_level = 3;
1834
1835    // If true, then skips saving the trace to incidentd.
1836    //
1837    // This flag is useful in testing (e.g. Perfetto-statsd integration tests)
1838    // or when we explicitly don't want traces to go to incidentd even when they
1839    // usually would (e.g. configs deployed using statsd but only used for
1840    // inclusion in bugreports using |bugreport_score|).
1841    //
1842    // The motivation for having this flag, instead of just not setting
1843    // |incident_report_config|, is prevent accidents where
1844    // |incident_report_config| is omitted by mistake.
1845    optional bool skip_incidentd = 5;
1846
1847    // If true, do not write the trace into dropbox (i.e. incident only).
1848    // Otherwise, write to both dropbox and incident.
1849    // TODO(lalitm): remove this field as we no longer use Dropbox.
1850    optional bool skip_dropbox = 4 [deprecated = true];
1851  }
1852  optional IncidentReportConfig incident_report_config = 25;
1853
1854  enum StatsdLogging {
1855    STATSD_LOGGING_UNSPECIFIED = 0;
1856    STATSD_LOGGING_ENABLED = 1;
1857    STATSD_LOGGING_DISABLED = 2;
1858  }
1859
1860  // Android-only. Not for general use. If specified, sets the logging to statsd
1861  // of guardrails and checkpoints in the tracing service. perfetto_cmd sets
1862  // this to enabled (if not explicitly set in the config) when specifying
1863  // --upload.
1864  optional StatsdLogging statsd_logging = 31;
1865
1866  // DEPRECATED. Was trace_uuid, use trace_uuid_msb and trace_uuid_lsb instead.
1867  reserved 26;
1868  // An identifier clients can use to tie this trace to other logging.
1869  // Alternative encoding of trace_uuid as two int64s.
1870  optional int64 trace_uuid_msb = 27;
1871  optional int64 trace_uuid_lsb = 28;
1872
1873  // When set applies a post-filter to the trace contents using the filter
1874  // provided. The filter is applied at ReadBuffers() time and works both in the
1875  // case of IPC readback and write_into_file. This filter can be generated
1876  // using `tools/proto_filter -s schema.proto -F filter_out.bytes` or
1877  // `-T filter_out.escaped_string` (for .pbtx).
1878  // Introduced in Android S. See go/trace-filtering for design.
1879  message TraceFilter { optional bytes bytecode = 1; }
1880  optional TraceFilter trace_filter = 32;
1881}
1882
1883// End of protos/perfetto/config/trace_config.proto
1884