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
1885// Begin of protos/perfetto/common/trace_stats.proto
1886
1887// Statistics for the internals of the tracing service.
1888//
1889// Next id: 11.
1890message TraceStats {
1891  // From TraceBuffer::Stats.
1892  //
1893  // Next id: 20.
1894  message BufferStats {
1895    // Size of the circular buffer in bytes.
1896    optional uint64 buffer_size = 12;
1897
1898    // Num. bytes written into the circular buffer, including chunk headers.
1899    optional uint64 bytes_written = 1;
1900
1901    // Num. bytes overwritten before they have been read (i.e. loss of data).
1902    optional uint64 bytes_overwritten = 13;
1903
1904    // Total size of chunks that were fully read from the circular buffer by the
1905    // consumer. This may not be equal to |bytes_written| either in the middle
1906    // of tracing, or if |chunks_overwritten| is non-zero. Note that this is the
1907    // size of the chunks read from the buffer, including chunk headers, which
1908    // will be different from the total size of packets returned to the
1909    // consumer.
1910    //
1911    // The current utilization of the trace buffer (mid-tracing) can be obtained
1912    // by subtracting |bytes_read| and |bytes_overwritten| from |bytes_written|,
1913    // adding the difference of |padding_bytes_written| and
1914    // |padding_bytes_cleared|, and comparing this sum to the |buffer_size|.
1915    // Note that this represents the total size of buffered data in the buffer,
1916    // yet this data may be spread non-contiguously through the buffer and may
1917    // be overridden before the utilization reaches 100%.
1918    optional uint64 bytes_read = 14;
1919
1920    // Num. bytes that were allocated as padding between chunks in the circular
1921    // buffer.
1922    optional uint64 padding_bytes_written = 15;
1923
1924    // Num. of padding bytes that were removed from the circular buffer when
1925    // they were overwritten.
1926    //
1927    // The difference between |padding_bytes_written| and
1928    // |padding_bytes_cleared| denotes the total size of padding currently
1929    // present in the buffer.
1930    optional uint64 padding_bytes_cleared = 16;
1931
1932    // Num. chunks (!= packets) written into the buffer.
1933    optional uint64 chunks_written = 2;
1934
1935    // Num. chunks (!= packets) rewritten into the buffer. This means we rewrote
1936    // the same chunk with additional packets appended to the end.
1937    optional uint64 chunks_rewritten = 10;
1938
1939    // Num. chunks overwritten before they have been read (i.e. loss of data).
1940    optional uint64 chunks_overwritten = 3;
1941
1942    // Num. chunks discarded (i.e. loss of data). Can be > 0 only when a buffer
1943    // is configured with FillPolicy == DISCARD.
1944    optional uint64 chunks_discarded = 18;
1945
1946    // Num. chunks (!= packets) that were fully read from the circular buffer by
1947    // the consumer. This may not be equal to |chunks_written| either in the
1948    // middle of tracing, or if |chunks_overwritten| is non-zero.
1949    optional uint64 chunks_read = 17;
1950
1951    // Num. chunks that were committed out of order.
1952    optional uint64 chunks_committed_out_of_order = 11;
1953
1954    // Num. times the ring buffer wrapped around.
1955    optional uint64 write_wrap_count = 4;
1956
1957    // Num. out-of-band (OOB) patches that succeeded.
1958    optional uint64 patches_succeeded = 5;
1959
1960    // Num. OOB patches that failed (e.g., the chunk to patch was gone).
1961    optional uint64 patches_failed = 6;
1962
1963    // Num. readaheads (for large multi-chunk packet reads) that ended up in a
1964    // successful packet read.
1965    optional uint64 readaheads_succeeded = 7;
1966
1967    // Num. readaheads aborted because of missing chunks in the sequence stream.
1968    // Note that a small number > 0 is totally expected: occasionally, when
1969    // issuing a read, the very last packet in a sequence might be incomplete
1970    // (because the producer is still writing it while we read). The read will
1971    // stop at that point, for that sequence, increasing this counter.
1972    optional uint64 readaheads_failed = 8;
1973
1974    // Num. of violations of the SharedMemoryABI found while writing or reading
1975    // the buffer. This is an indication of either a bug in the producer(s) or
1976    // malicious producer(s).
1977    optional uint64 abi_violations = 9;
1978
1979    // The fields below have been introduced in Android R.
1980
1981    // Num. of times the service detected packet loss on a trace writer
1982    // sequence. This is usually caused by exhaustion of available chunks in the
1983    // writer process's SMB. Note that this relies on the client's TraceWriter
1984    // indicating this loss to the service -- packets lost for other reasons are
1985    // not reflected in this stat.
1986    optional uint64 trace_writer_packet_loss = 19;
1987  }
1988
1989  // Stats for the TraceBuffer(s) of the current trace session.
1990  repeated BufferStats buffer_stats = 1;
1991
1992  // Num. producers connected (whether they are involved in the current tracing
1993  // session or not).
1994  optional uint32 producers_connected = 2;
1995
1996  // Num. producers ever seen for all trace sessions since startup (it's a good
1997  // proxy for inferring num. producers crashed / killed).
1998  optional uint64 producers_seen = 3;
1999
2000  // Num. data sources registered for all trace sessions.
2001  optional uint32 data_sources_registered = 4;
2002
2003  // Num. data sources ever seen for all trace sessions since startup.
2004  optional uint64 data_sources_seen = 5;
2005
2006  // Num. concurrently active tracing sessions.
2007  optional uint32 tracing_sessions = 6;
2008
2009  // Num. buffers for all tracing session (not just the current one). This will
2010  // be >= buffer_stats.size(), because the latter is only about the current
2011  // session.
2012  optional uint32 total_buffers = 7;
2013
2014  // The fields below have been introduced in Android Q.
2015
2016  // Num. chunks that were discarded by the service before attempting to commit
2017  // them to a buffer, e.g. because the producer specified an invalid buffer ID.
2018  optional uint64 chunks_discarded = 8;
2019
2020  // Num. patches that were discarded by the service before attempting to apply
2021  // them to a buffer, e.g. because the producer specified an invalid buffer ID.
2022  optional uint64 patches_discarded = 9;
2023
2024  // Packets that failed validation of the TrustedPacket. If this is > 0, there
2025  // is a bug in the producer.
2026  optional uint64 invalid_packets = 10;
2027
2028  // This is set only when the TraceConfig specifies a TraceFilter.
2029  message FilterStats {
2030    optional uint64 input_packets = 1;
2031    optional uint64 input_bytes = 2;
2032    optional uint64 output_bytes = 3;
2033    optional uint64 errors = 4;
2034  }
2035  optional FilterStats filter_stats = 11;
2036}
2037
2038// End of protos/perfetto/common/trace_stats.proto
2039
2040// Begin of protos/perfetto/trace/android/android_log.proto
2041
2042message AndroidLogPacket {
2043  message LogEvent {
2044    // The log buffer (e.g. MAIN, SYSTEM, RADIO) the event comes from.
2045    optional AndroidLogId log_id = 1;
2046
2047    // PID (TGID), TID and UID of the task that emitted the event.
2048    optional int32 pid = 2;
2049    optional int32 tid = 3;
2050    optional int32 uid = 4;
2051
2052    // Timestamp [ns]. The clock source is CLOCK_REALTIME, unlike many other
2053    // Perfetto trace events that instead use CLOCK_BOOTTIME. The trace
2054    // processor will take care of realigning clocks using the ClockSnapshot(s).
2055    optional uint64 timestamp = 5;
2056
2057    // When log_id == LID_EVENTS, |tag| corresponds to the event name defined in
2058    // the second column of /system/etc/event-log-tags. For all other events,
2059    // |tag| is the app-specified argument passed to __android_log_write().
2060    optional string tag = 6;
2061
2062    // Empty when log_id == LID_EVENTS.
2063    optional AndroidLogPriority prio = 7;
2064
2065    // Empty when log_id == LID_EVENTS.
2066    optional string message = 8;
2067
2068    message Arg {
2069      optional string name = 1;
2070      oneof value {
2071        int64 int_value = 2;
2072        float float_value = 3;
2073        string string_value = 4;
2074      }
2075    }
2076    // Only populated when log_id == LID_EVENTS.
2077    repeated Arg args = 9;
2078  }
2079
2080  repeated LogEvent events = 1;
2081
2082  // Stats are emitted only upon Flush() and are monotonic (i.e. they are
2083  // absolute counters since the beginning of the lifetime of the tracing
2084  // session and NOT relative to the previous Stats snapshot).
2085  message Stats {
2086    // Total number of log events seen, including errors and skipped entries
2087    // (num of events stored in the trace = total - failed - skipped).
2088    optional uint64 num_total = 1;
2089
2090    // Parser failures.
2091    optional uint64 num_failed = 2;
2092
2093    // Messages skipped due to filters.
2094    optional uint64 num_skipped = 3;
2095  }
2096  optional Stats stats = 2;
2097}
2098
2099// End of protos/perfetto/trace/android/android_log.proto
2100
2101// Begin of protos/perfetto/trace/android/frame_timeline_event.proto
2102
2103// Generated by SurfaceFlinger's FrameTimeline (go/adaptive-scheduling-fr).
2104// Used in comparing the expected timeline of a frame to the actual timeline.
2105// Key terms:
2106//    1) DisplayFrame - represents SurfaceFlinger's work on a frame(composited)
2107//    2) SurfaceFrame - represents App's work on its frame
2108//    3) Timeline = start to end of a component's(app/SF) work on a frame.
2109// SurfaceFlinger composites frames from many apps together, so
2110//    One DisplayFrame can map to N SurfaceFrame(s)
2111// This relationship can be reconstructed by using
2112//    DisplayFrame.token = SurfaceFrame.display_frame_token
2113message FrameTimelineEvent {
2114  // Specifies the reason(s) most likely to have caused the jank.
2115  // Used as a bitmask.
2116  enum JankType {
2117    JANK_UNSPECIFIED = 0;
2118    JANK_NONE = 1;
2119    JANK_SF_SCHEDULING = 2;
2120    JANK_PREDICTION_ERROR = 4;
2121    JANK_DISPLAY_HAL = 8;
2122    JANK_SF_CPU_DEADLINE_MISSED = 16;
2123    JANK_SF_GPU_DEADLINE_MISSED = 32;
2124    JANK_APP_DEADLINE_MISSED = 64;
2125    JANK_BUFFER_STUFFING = 128;
2126    JANK_UNKNOWN = 256;
2127    JANK_SF_STUFFING = 512;
2128  };
2129
2130  // Specifies how a frame was presented on screen w.r.t. timing.
2131  // Can be different for SurfaceFrame and DisplayFrame.
2132  enum PresentType {
2133    PRESENT_UNSPECIFIED = 0;
2134    PRESENT_ON_TIME = 1;
2135    PRESENT_LATE = 2;
2136    PRESENT_EARLY = 3;
2137    PRESENT_DROPPED = 4;
2138    PRESENT_UNKNOWN = 5;
2139  };
2140
2141  // Specifies if the predictions for the frame are still valid, expired or
2142  // unknown.
2143  enum PredictionType {
2144    PREDICTION_UNSPECIFIED = 0;
2145    PREDICTION_VALID = 1;
2146    PREDICTION_EXPIRED = 2;
2147    PREDICTION_UNKNOWN = 3;
2148  };
2149
2150  // Indicates the start of expected timeline slice for SurfaceFrames.
2151  message ExpectedSurfaceFrameStart {
2152    // Cookie used to correlate between the start and end messages of the same
2153    // frame. Since all values except the ts are same for start and end, cookie
2154    // helps in preventing redundant data transmission.
2155    // The same cookie is used only by start and end messages of a single frame
2156    // and is otherwise unique.
2157    optional int64 cookie = 1;
2158
2159    // Token received by the app for its work. Can be shared between multiple
2160    // layers of the same app (example: pip mode).
2161    optional int64 token = 2;
2162    // The corresponding DisplayFrame token is required to link the App's work
2163    // with SurfaceFlinger's work. Many SurfaceFrames can be mapped to a single
2164    // DisplayFrame.
2165    // this.display_frame_token = DisplayFrame.token
2166    optional int64 display_frame_token = 3;
2167
2168    // Pid of the app. Used in creating the timeline tracks (and slices) inside
2169    // the respective process track group.
2170    optional int32 pid = 4;
2171    optional string layer_name = 5;
2172  };
2173
2174  // Indicates the start of actual timeline slice for SurfaceFrames. Also
2175  // includes the jank information.
2176  message ActualSurfaceFrameStart {
2177    // Cookie used to correlate between the start and end messages of the same
2178    // frame. Since all values except the ts are same for start and end, cookie
2179    // helps in preventing redundant data transmission.
2180    // The same cookie is used only by start and end messages of a single frame
2181    // and is otherwise unique.
2182    optional int64 cookie = 1;
2183
2184    // Token received by the app for its work. Can be shared between multiple
2185    // layers of the same app (example: pip mode).
2186    optional int64 token = 2;
2187    // The corresponding DisplayFrame token is required to link the App's work
2188    // with SurfaceFlinger's work. Many SurfaceFrames can be mapped to a single
2189    // DisplayFrame.
2190    // this.display_frame_token = DisplayFrame.token
2191    optional int64 display_frame_token = 3;
2192
2193    // Pid of the app. Used in creating the timeline tracks (and slices) inside
2194    // the respective process track group.
2195    optional int32 pid = 4;
2196    optional string layer_name = 5;
2197
2198    optional PresentType present_type = 6;
2199    optional bool on_time_finish = 7;
2200    optional bool gpu_composition = 8;
2201    // A bitmask of JankType. More than one reason can be attributed to a janky
2202    // frame.
2203    optional int32 jank_type = 9;
2204    optional PredictionType prediction_type = 10;
2205    optional bool is_buffer = 11;
2206  };
2207
2208  // Indicates the start of expected timeline slice for DisplayFrames.
2209  message ExpectedDisplayFrameStart {
2210    // Cookie used to correlate between the start and end messages of the same
2211    // frame. Since all values except the ts are same for start and end, cookie
2212    // helps in preventing redundant data transmission.
2213    // The same cookie is used only by start and end messages of a single frame
2214    // and is otherwise unique.
2215    optional int64 cookie = 1;
2216
2217    // Token received by SurfaceFlinger for its work
2218    // this.token = SurfaceFrame.display_frame_token
2219    optional int64 token = 2;
2220
2221    // Pid of SurfaceFlinger. Used in creating the timeline tracks (and slices)
2222    // inside the SurfaceFlinger process group.
2223    optional int32 pid = 3;
2224  };
2225
2226  // Indicates the start of actual timeline slice for DisplayFrames. Also
2227  // includes the jank information.
2228  message ActualDisplayFrameStart {
2229    // Cookie used to correlate between the start and end messages of the same
2230    // frame. Since all values except the ts are same for start and end, cookie
2231    // helps in preventing redundant data transmission.
2232    // The same cookie is used only by start and end messages of a single frame
2233    // and is otherwise unique.
2234    optional int64 cookie = 1;
2235
2236    // Token received by SurfaceFlinger for its work
2237    // this.token = SurfaceFrame.display_frame_token
2238    optional int64 token = 2;
2239
2240    // Pid of SurfaceFlinger. Used in creating the timeline tracks (and slices)
2241    // inside the SurfaceFlinger process group.
2242    optional int32 pid = 3;
2243
2244    optional PresentType present_type = 4;
2245    optional bool on_time_finish = 5;
2246    optional bool gpu_composition = 6;
2247    // A bitmask of JankType. More than one reason can be attributed to a janky
2248    // frame.
2249    optional int32 jank_type = 7;
2250    optional PredictionType prediction_type = 8;
2251  };
2252
2253  // FrameEnd just sends the cookie to indicate that the corresponding
2254  // <display/surface>frame slice's end.
2255  message FrameEnd { optional int64 cookie = 1; };
2256
2257  oneof event {
2258    ExpectedDisplayFrameStart expected_display_frame_start = 1;
2259    ActualDisplayFrameStart actual_display_frame_start = 2;
2260
2261    ExpectedSurfaceFrameStart expected_surface_frame_start = 3;
2262    ActualSurfaceFrameStart actual_surface_frame_start = 4;
2263
2264    FrameEnd frame_end = 5;
2265  }
2266}
2267
2268// End of protos/perfetto/trace/android/frame_timeline_event.proto
2269
2270// Begin of protos/perfetto/trace/android/gpu_mem_event.proto
2271
2272// Generated by Android's GpuService.
2273message GpuMemTotalEvent {
2274  optional uint32 gpu_id = 1;
2275  optional uint32 pid = 2;
2276  optional uint64 size = 3;
2277}
2278
2279// End of protos/perfetto/trace/android/gpu_mem_event.proto
2280
2281// Begin of protos/perfetto/trace/android/graphics_frame_event.proto
2282
2283// Generated by Android's SurfaceFlinger.
2284message GraphicsFrameEvent {
2285  enum BufferEventType {
2286    UNSPECIFIED = 0;
2287    DEQUEUE = 1;
2288    QUEUE = 2;
2289    POST = 3;
2290    ACQUIRE_FENCE = 4;
2291    LATCH = 5;
2292    // HWC will compose this buffer
2293    HWC_COMPOSITION_QUEUED = 6;
2294    // renderEngine composition
2295    FALLBACK_COMPOSITION = 7;
2296    PRESENT_FENCE = 8;
2297    RELEASE_FENCE = 9;
2298    MODIFY = 10;
2299    DETACH = 11;
2300    ATTACH = 12;
2301    CANCEL = 13;
2302  }
2303
2304  message BufferEvent {
2305    optional uint32 frame_number = 1;
2306    optional BufferEventType type = 2;
2307    optional string layer_name = 3;
2308    // If no duration is set, the event is an instant event.
2309    optional uint64 duration_ns = 4;
2310    // Unique buffer identifier.
2311    optional uint32 buffer_id = 5;
2312  }
2313
2314  optional BufferEvent buffer_event = 1;
2315}
2316
2317// End of protos/perfetto/trace/android/graphics_frame_event.proto
2318
2319// Begin of protos/perfetto/trace/android/initial_display_state.proto
2320
2321message InitialDisplayState {
2322  // Same values as android.view.Display.STATE_*
2323  optional int32 display_state = 1;
2324  optional double brightness = 2;
2325}
2326
2327// End of protos/perfetto/trace/android/initial_display_state.proto
2328
2329// Begin of protos/perfetto/trace/android/packages_list.proto
2330
2331message PackagesList {
2332  message PackageInfo {
2333    optional string name = 1;
2334    optional uint64 uid = 2;
2335    optional bool debuggable = 3;
2336    optional bool profileable_from_shell = 4;
2337    optional int64 version_code = 5;
2338  }
2339
2340  repeated PackageInfo packages = 1;
2341
2342  // At least one error occurred parsing the packages.list.
2343  optional bool parse_error = 2;
2344
2345  // Failed to open / read packages.list.
2346  optional bool read_error = 3;
2347}
2348
2349// End of protos/perfetto/trace/android/packages_list.proto
2350
2351// Begin of protos/perfetto/trace/chrome/chrome_benchmark_metadata.proto
2352
2353// This message is not intended to be written by the chrome on the device.
2354// It's emitted on the host by the telemetry benchmark infrastructure (it's a
2355// part of the trace that's written by the telemetry tracing agent).
2356message ChromeBenchmarkMetadata {
2357  // Time when the benchmark execution started (host unixtime in microseconds).
2358  optional int64 benchmark_start_time_us = 1;
2359
2360  // Time when this particular story was run (host unixtime in microseconds).
2361  optional int64 story_run_time_us = 2;
2362
2363  // Name of benchmark.
2364  optional string benchmark_name = 3;
2365
2366  // Description of benchmark.
2367  optional string benchmark_description = 4;
2368
2369  // Optional label.
2370  optional string label = 5;
2371
2372  // Name of story.
2373  optional string story_name = 6;
2374
2375  // List of story tags.
2376  repeated string story_tags = 7;
2377
2378  // Index of the story run (>0 if the same story was run several times).
2379  optional int32 story_run_index = 8;
2380
2381  // Whether this run failed.
2382  optional bool had_failures = 9;
2383}
2384
2385// End of protos/perfetto/trace/chrome/chrome_benchmark_metadata.proto
2386
2387// Begin of protos/perfetto/trace/chrome/chrome_metadata.proto
2388
2389// Metadata for chrome traces.
2390message ChromeMetadataPacket {
2391  optional BackgroundTracingMetadata background_tracing_metadata = 1;
2392
2393  // Version code of Chrome used by Android's Play Store. This field is only set
2394  // on Android.
2395  optional int32 chrome_version_code = 2;
2396
2397  // Comma separated list of enabled categories for tracing. The list of
2398  // possible category strings are listed in code
2399  // base/trace_event/builtin_categories.h.
2400  optional string enabled_categories = 3;
2401}
2402
2403// Metadata related to background tracing scenarios, states and triggers.
2404message BackgroundTracingMetadata {
2405  // Information about a trigger rule defined in the experiment config.
2406  message TriggerRule {
2407    enum TriggerType {
2408      TRIGGER_UNSPECIFIED = 0;
2409
2410      // Traces are triggered by specific range of values of an UMA histogram.
2411      MONITOR_AND_DUMP_WHEN_SPECIFIC_HISTOGRAM_AND_VALUE = 1;
2412
2413      // Traces are triggered by specific named events in chromium codebase,
2414      // like "second-update-failure".
2415      MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED = 2;
2416    }
2417    optional TriggerType trigger_type = 1;
2418
2419    // Configuration of histogram trigger.
2420    message HistogramRule {
2421      // UMA histogram name hash, same as HistogramEventProto.name_hash.
2422      optional fixed64 histogram_name_hash = 1;
2423
2424      // Range of values of the histogram that activates trigger.
2425      optional int64 histogram_min_trigger = 2;
2426      optional int64 histogram_max_trigger = 3;
2427    }
2428    optional HistogramRule histogram_rule = 2;
2429
2430    // Configuration of named trigger.
2431    message NamedRule {
2432      enum EventType {
2433        UNSPECIFIED = 0;
2434        SESSION_RESTORE = 1;
2435        NAVIGATION = 2;
2436        STARTUP = 3;
2437        REACHED_CODE = 4;
2438        CONTENT_TRIGGER = 5;
2439
2440        TEST_RULE = 1000;
2441      }
2442      optional EventType event_type = 1;
2443
2444      // If |event_type| is CONTENT_TRIGGER, then this stores the hash of the
2445      // content-trigger that actually fired.
2446      optional fixed64 content_trigger_name_hash = 2;
2447    }
2448    optional NamedRule named_rule = 3;
2449  }
2450
2451  // Specifies the rule that caused the trace to be uploaded.
2452  optional TriggerRule triggered_rule = 1;
2453
2454  // List of all active triggers in current session, when trace was triggered.
2455  repeated TriggerRule active_rules = 2;
2456}
2457
2458// End of protos/perfetto/trace/chrome/chrome_metadata.proto
2459
2460// Begin of protos/perfetto/trace/chrome/chrome_trace_event.proto
2461
2462message ChromeTracedValue {
2463  enum NestedType {
2464    DICT = 0;
2465    ARRAY = 1;
2466  }
2467  optional NestedType nested_type = 1;
2468
2469  repeated string dict_keys = 2;
2470  repeated ChromeTracedValue dict_values = 3;
2471  repeated ChromeTracedValue array_values = 4;
2472  optional int32 int_value = 5;
2473  optional double double_value = 6;
2474  optional bool bool_value = 7;
2475  optional string string_value = 8;
2476}
2477
2478message ChromeStringTableEntry {
2479  optional string value = 1;
2480  optional int32 index = 2;
2481}
2482
2483// Deprecated, use TrackEvent protos instead.
2484message ChromeTraceEvent {
2485  message Arg {
2486    optional string name = 1;
2487
2488    oneof value {
2489      bool bool_value = 2;
2490      uint64 uint_value = 3;
2491      int64 int_value = 4;
2492      double double_value = 5;
2493      string string_value = 6;
2494      // Pointers are stored in a separate type as the JSON output treats them
2495      // differently from other uint64 values.
2496      uint64 pointer_value = 7;
2497      string json_value = 8;
2498      ChromeTracedValue traced_value = 10;
2499    }
2500
2501    // Takes precedence over |name| if set,
2502    // and is an index into |string_table|.
2503    optional uint32 name_index = 9;
2504  }
2505
2506  optional string name = 1;
2507  optional int64 timestamp = 2;
2508  optional int32 phase = 3;
2509  optional int32 thread_id = 4;
2510  optional int64 duration = 5;
2511  optional int64 thread_duration = 6;
2512  optional string scope = 7;
2513  optional uint64 id = 8;
2514  optional uint32 flags = 9;
2515  optional string category_group_name = 10;
2516  optional int32 process_id = 11;
2517  optional int64 thread_timestamp = 12;
2518  optional uint64 bind_id = 13;
2519
2520  repeated Arg args = 14;
2521
2522  // Takes precedence over respectively |name| and
2523  // |category_group_name_index| if set,
2524  // and are indices into |string_table|.
2525  optional uint32 name_index = 15;
2526  optional uint32 category_group_name_index = 16;
2527}
2528
2529message ChromeMetadata {
2530  optional string name = 1;
2531
2532  oneof value {
2533    string string_value = 2;
2534    bool bool_value = 3;
2535    int64 int_value = 4;
2536    string json_value = 5;
2537  }
2538}
2539
2540// Subtraces produced in legacy json format by Chrome tracing agents not yet
2541// updated to support the new binary format, e.g. ETW and CrOS ARC.
2542// TODO(eseckler): Update these agents to become perfetto producers.
2543message ChromeLegacyJsonTrace {
2544  enum TraceType {
2545    USER_TRACE = 0;
2546
2547    // Deprecated.
2548    SYSTEM_TRACE = 1;
2549  }
2550  optional TraceType type = 1;
2551  optional string data = 2;
2552}
2553
2554message ChromeEventBundle {
2555  // Deprecated, use TrackEvent protos instead.
2556  repeated ChromeTraceEvent trace_events = 1 [deprecated = true];
2557  // TODO(ssid): This should be deprecated in favor of ChromeMetadataPacket
2558  // which contains typed fields.
2559  repeated ChromeMetadata metadata = 2;
2560  // ftrace output from CrOS and Cast system tracing agents.
2561  // TODO(eseckler): Replace system traces with native perfetto service.
2562  repeated string legacy_ftrace_output = 4;
2563  repeated ChromeLegacyJsonTrace legacy_json_trace = 5;
2564
2565  // Contents of a string table that's valid for
2566  // the whole ChromeEventBundle entry.
2567  repeated ChromeStringTableEntry string_table = 3 [deprecated = true];
2568}
2569
2570// End of protos/perfetto/trace/chrome/chrome_trace_event.proto
2571
2572// Begin of protos/perfetto/trace/clock_snapshot.proto
2573
2574// A snapshot of clock readings to allow for trace alignment.
2575message ClockSnapshot {
2576  message Clock {
2577    // DEPRECATED. This enum has moved to ../common/builtin_clock.proto.
2578    enum BuiltinClocks {
2579      UNKNOWN = 0;
2580      REALTIME = 1;
2581      REALTIME_COARSE = 2;
2582      MONOTONIC = 3;
2583      MONOTONIC_COARSE = 4;
2584      MONOTONIC_RAW = 5;
2585      BOOTTIME = 6;
2586      BUILTIN_CLOCK_MAX_ID = 63;
2587
2588      reserved 7, 8;
2589    }
2590
2591    // Clock IDs have the following semantic:
2592    // [1, 63]:    Builtin types, see BuiltinClock from
2593    //             ../common/builtin_clock.proto.
2594    // [64, 127]:  User-defined clocks. These clocks are sequence-scoped. They
2595    //             are only valid within the same |trusted_packet_sequence_id|
2596    //             (i.e. only for TracePacket(s) emitted by the same TraceWriter
2597    //             that emitted the clock snapshot).
2598    // [128, MAX]: Reserved for future use. The idea is to allow global clock
2599    //             IDs and setting this ID to hash(full_clock_name) & ~127.
2600    optional uint32 clock_id = 1;
2601
2602    // Absolute timestamp. Unit is ns unless specified otherwise by the
2603    // unit_multiplier_ns field below.
2604    optional uint64 timestamp = 2;
2605
2606    // When true each TracePacket's timestamp should be interpreted as a delta
2607    // from the last TracePacket's timestamp (referencing this clock) emitted by
2608    // the same packet_sequence_id. Should only be used for user-defined
2609    // sequence-local clocks. The first packet timestamp after each
2610    // ClockSnapshot that contains this clock is relative to the |timestamp| in
2611    // the ClockSnapshot.
2612    optional bool is_incremental = 3;
2613
2614    // Allows to specify a custom unit different than the default (ns) for this
2615    // clock domain. A multiplier of 1000 means that a timestamp = 3 should be
2616    // interpreted as 3000 ns = 3 us. All snapshots for the same clock within a
2617    // trace need to use the same unit.
2618    optional uint64 unit_multiplier_ns = 4;
2619  }
2620  repeated Clock clocks = 1;
2621
2622  // The authoritative clock domain for the trace. Defaults to BOOTTIME, but can
2623  // be overridden in TraceConfig's builtin_data_sources. Trace processor will
2624  // attempt to translate packet/event timestamps from various data sources (and
2625  // their chosen clock domains) to this domain during import.
2626  optional BuiltinClock primary_trace_clock = 2;
2627}
2628
2629// End of protos/perfetto/trace/clock_snapshot.proto
2630
2631// Begin of protos/perfetto/common/descriptor.proto
2632
2633// The protocol compiler can output a FileDescriptorSet containing the .proto
2634// files it parses.
2635message FileDescriptorSet {
2636  repeated FileDescriptorProto file = 1;
2637}
2638
2639// Describes a complete .proto file.
2640message FileDescriptorProto {
2641  // file name, relative to root of source tree
2642  optional string name = 1;
2643  // e.g. "foo", "foo.bar", etc.
2644  optional string package = 2;
2645
2646  // Names of files imported by this file.
2647  repeated string dependency = 3;
2648  // Indexes of the public imported files in the dependency list above.
2649  repeated int32 public_dependency = 10;
2650  // Indexes of the weak imported files in the dependency list.
2651  // For Google-internal migration only. Do not use.
2652  repeated int32 weak_dependency = 11;
2653
2654  // All top-level definitions in this file.
2655  repeated DescriptorProto message_type = 4;
2656  repeated EnumDescriptorProto enum_type = 5;
2657  repeated FieldDescriptorProto extension = 7;
2658
2659  reserved 6;
2660  reserved 8;
2661  reserved 9;
2662  reserved 12;
2663}
2664
2665// Describes a message type.
2666message DescriptorProto {
2667  optional string name = 1;
2668
2669  repeated FieldDescriptorProto field = 2;
2670  repeated FieldDescriptorProto extension = 6;
2671
2672  repeated DescriptorProto nested_type = 3;
2673  repeated EnumDescriptorProto enum_type = 4;
2674
2675  reserved 5;
2676
2677  repeated OneofDescriptorProto oneof_decl = 8;
2678
2679  reserved 7;
2680
2681  // Range of reserved tag numbers. Reserved tag numbers may not be used by
2682  // fields or extension ranges in the same message. Reserved ranges may
2683  // not overlap.
2684  message ReservedRange {
2685    // Inclusive.
2686    optional int32 start = 1;
2687    // Exclusive.
2688    optional int32 end = 2;
2689  }
2690  repeated ReservedRange reserved_range = 9;
2691  // Reserved field names, which may not be used by fields in the same message.
2692  // A given name may only be reserved once.
2693  repeated string reserved_name = 10;
2694}
2695
2696// Describes a field within a message.
2697message FieldDescriptorProto {
2698  enum Type {
2699    // 0 is reserved for errors.
2700    // Order is weird for historical reasons.
2701    TYPE_DOUBLE = 1;
2702    TYPE_FLOAT = 2;
2703    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
2704    // negative values are likely.
2705    TYPE_INT64 = 3;
2706    TYPE_UINT64 = 4;
2707    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
2708    // negative values are likely.
2709    TYPE_INT32 = 5;
2710    TYPE_FIXED64 = 6;
2711    TYPE_FIXED32 = 7;
2712    TYPE_BOOL = 8;
2713    TYPE_STRING = 9;
2714    // Tag-delimited aggregate.
2715    // Group type is deprecated and not supported in proto3. However, Proto3
2716    // implementations should still be able to parse the group wire format and
2717    // treat group fields as unknown fields.
2718    TYPE_GROUP = 10;
2719    // Length-delimited aggregate.
2720    TYPE_MESSAGE = 11;
2721
2722    // New in version 2.
2723    TYPE_BYTES = 12;
2724    TYPE_UINT32 = 13;
2725    TYPE_ENUM = 14;
2726    TYPE_SFIXED32 = 15;
2727    TYPE_SFIXED64 = 16;
2728    // Uses ZigZag encoding.
2729    TYPE_SINT32 = 17;
2730    // Uses ZigZag encoding.
2731    TYPE_SINT64 = 18;
2732  };
2733
2734  enum Label {
2735    // 0 is reserved for errors
2736    LABEL_OPTIONAL = 1;
2737    LABEL_REQUIRED = 2;
2738    LABEL_REPEATED = 3;
2739  };
2740
2741  optional string name = 1;
2742  optional int32 number = 3;
2743  optional Label label = 4;
2744
2745  // If type_name is set, this need not be set.  If both this and type_name
2746  // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
2747  optional Type type = 5;
2748
2749  // For message and enum types, this is the name of the type.  If the name
2750  // starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
2751  // rules are used to find the type (i.e. first the nested types within this
2752  // message are searched, then within the parent, on up to the root
2753  // namespace).
2754  optional string type_name = 6;
2755
2756  // For extensions, this is the name of the type being extended.  It is
2757  // resolved in the same manner as type_name.
2758  optional string extendee = 2;
2759
2760  // For numeric types, contains the original text representation of the value.
2761  // For booleans, "true" or "false".
2762  // For strings, contains the default text contents (not escaped in any way).
2763  // For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
2764  // TODO(kenton):  Base-64 encode?
2765  optional string default_value = 7;
2766
2767  // If set, gives the index of a oneof in the containing type's oneof_decl
2768  // list.  This field is a member of that oneof.
2769  optional int32 oneof_index = 9;
2770
2771  reserved 10;
2772
2773  reserved 8;
2774}
2775
2776// Describes a oneof.
2777message OneofDescriptorProto {
2778  optional string name = 1;
2779  optional OneofOptions options = 2;
2780}
2781
2782// Describes an enum type.
2783message EnumDescriptorProto {
2784  optional string name = 1;
2785
2786  repeated EnumValueDescriptorProto value = 2;
2787
2788  reserved 3;
2789  reserved 4;
2790
2791  // Reserved enum value names, which may not be reused. A given name may only
2792  // be reserved once.
2793  repeated string reserved_name = 5;
2794}
2795
2796// Describes a value within an enum.
2797message EnumValueDescriptorProto {
2798  optional string name = 1;
2799  optional int32 number = 2;
2800
2801  reserved 3;
2802}
2803
2804message OneofOptions {
2805  reserved 999;
2806
2807  // Clients can define custom options in extensions of this message. See above.
2808  extensions 1000 to max;
2809}
2810
2811// End of protos/perfetto/common/descriptor.proto
2812
2813// Begin of protos/perfetto/trace/extension_descriptor.proto
2814
2815// This message contains descriptors used to parse extension fields of
2816// TrackEvent.
2817//
2818// See docs/design-docs/extensions.md for more details.
2819message ExtensionDescriptor {
2820  optional FileDescriptorSet extension_set = 1;
2821}
2822
2823// End of protos/perfetto/trace/extension_descriptor.proto
2824
2825// Begin of protos/perfetto/trace/filesystem/inode_file_map.proto
2826
2827// Represents the mapping between inode numbers in a block device and their path
2828// on the filesystem
2829message InodeFileMap {
2830  // Representation of Entry
2831  message Entry {
2832    optional uint64 inode_number = 1;
2833
2834    // The path to the file, e.g. "etc/file.xml"
2835    // List of strings for multiple hardlinks
2836    repeated string paths = 2;
2837
2838    // The file type
2839    enum Type {
2840      UNKNOWN = 0;
2841      FILE = 1;
2842      DIRECTORY = 2;
2843    }
2844    optional Type type = 3;
2845  }
2846
2847  optional uint64 block_device_id = 1;
2848
2849  // The mount points of the block device, e.g. ["system"].
2850  repeated string mount_points = 2;
2851
2852  // The list of all the entries from the block device
2853  repeated Entry entries = 3;
2854}
2855
2856// End of protos/perfetto/trace/filesystem/inode_file_map.proto
2857
2858// Begin of protos/perfetto/trace/ftrace/binder.proto
2859
2860message BinderTransactionFtraceEvent {
2861  optional int32 debug_id = 1;
2862  optional int32 target_node = 2;
2863  optional int32 to_proc = 3;
2864  optional int32 to_thread = 4;
2865  optional int32 reply = 5;
2866  optional uint32 code = 6;
2867  optional uint32 flags = 7;
2868}
2869message BinderTransactionReceivedFtraceEvent {
2870  optional int32 debug_id = 1;
2871}
2872message BinderSetPriorityFtraceEvent {
2873  optional int32 proc = 1;
2874  optional int32 thread = 2;
2875  optional uint32 old_prio = 3;
2876  optional uint32 new_prio = 4;
2877  optional uint32 desired_prio = 5;
2878}
2879message BinderLockFtraceEvent {
2880  optional string tag = 1;
2881}
2882message BinderLockedFtraceEvent {
2883  optional string tag = 1;
2884}
2885message BinderUnlockFtraceEvent {
2886  optional string tag = 1;
2887}
2888message BinderTransactionAllocBufFtraceEvent {
2889  optional uint64 data_size = 1;
2890  optional int32 debug_id = 2;
2891  optional uint64 offsets_size = 3;
2892}
2893
2894// End of protos/perfetto/trace/ftrace/binder.proto
2895
2896// Begin of protos/perfetto/trace/ftrace/block.proto
2897
2898message BlockRqIssueFtraceEvent {
2899  optional uint64 dev = 1;
2900  optional uint64 sector = 2;
2901  optional uint32 nr_sector = 3;
2902  optional uint32 bytes = 4;
2903  optional string rwbs = 5;
2904  optional string comm = 6;
2905  optional string cmd = 7;
2906}
2907message BlockBioBackmergeFtraceEvent {
2908  optional uint64 dev = 1;
2909  optional uint64 sector = 2;
2910  optional uint32 nr_sector = 3;
2911  optional string rwbs = 4;
2912  optional string comm = 5;
2913}
2914message BlockBioBounceFtraceEvent {
2915  optional uint64 dev = 1;
2916  optional uint64 sector = 2;
2917  optional uint32 nr_sector = 3;
2918  optional string rwbs = 4;
2919  optional string comm = 5;
2920}
2921message BlockBioCompleteFtraceEvent {
2922  optional uint64 dev = 1;
2923  optional uint64 sector = 2;
2924  optional uint32 nr_sector = 3;
2925  optional int32 error = 4;
2926  optional string rwbs = 5;
2927}
2928message BlockBioFrontmergeFtraceEvent {
2929  optional uint64 dev = 1;
2930  optional uint64 sector = 2;
2931  optional uint32 nr_sector = 3;
2932  optional string rwbs = 4;
2933  optional string comm = 5;
2934}
2935message BlockBioQueueFtraceEvent {
2936  optional uint64 dev = 1;
2937  optional uint64 sector = 2;
2938  optional uint32 nr_sector = 3;
2939  optional string rwbs = 4;
2940  optional string comm = 5;
2941}
2942message BlockBioRemapFtraceEvent {
2943  optional uint64 dev = 1;
2944  optional uint64 sector = 2;
2945  optional uint32 nr_sector = 3;
2946  optional uint64 old_dev = 4;
2947  optional uint64 old_sector = 5;
2948  optional string rwbs = 6;
2949}
2950message BlockDirtyBufferFtraceEvent {
2951  optional uint64 dev = 1;
2952  optional uint64 sector = 2;
2953  optional uint64 size = 3;
2954}
2955message BlockGetrqFtraceEvent {
2956  optional uint64 dev = 1;
2957  optional uint64 sector = 2;
2958  optional uint32 nr_sector = 3;
2959  optional string rwbs = 4;
2960  optional string comm = 5;
2961}
2962message BlockPlugFtraceEvent {
2963  optional string comm = 1;
2964}
2965message BlockRqAbortFtraceEvent {
2966  optional uint64 dev = 1;
2967  optional uint64 sector = 2;
2968  optional uint32 nr_sector = 3;
2969  optional int32 errors = 4;
2970  optional string rwbs = 5;
2971  optional string cmd = 6;
2972}
2973message BlockRqCompleteFtraceEvent {
2974  optional uint64 dev = 1;
2975  optional uint64 sector = 2;
2976  optional uint32 nr_sector = 3;
2977  optional int32 errors = 4;
2978  optional string rwbs = 5;
2979  optional string cmd = 6;
2980}
2981message BlockRqInsertFtraceEvent {
2982  optional uint64 dev = 1;
2983  optional uint64 sector = 2;
2984  optional uint32 nr_sector = 3;
2985  optional uint32 bytes = 4;
2986  optional string rwbs = 5;
2987  optional string comm = 6;
2988  optional string cmd = 7;
2989}
2990message BlockRqRemapFtraceEvent {
2991  optional uint64 dev = 1;
2992  optional uint64 sector = 2;
2993  optional uint32 nr_sector = 3;
2994  optional uint64 old_dev = 4;
2995  optional uint64 old_sector = 5;
2996  optional uint32 nr_bios = 6;
2997  optional string rwbs = 7;
2998}
2999message BlockRqRequeueFtraceEvent {
3000  optional uint64 dev = 1;
3001  optional uint64 sector = 2;
3002  optional uint32 nr_sector = 3;
3003  optional int32 errors = 4;
3004  optional string rwbs = 5;
3005  optional string cmd = 6;
3006}
3007message BlockSleeprqFtraceEvent {
3008  optional uint64 dev = 1;
3009  optional uint64 sector = 2;
3010  optional uint32 nr_sector = 3;
3011  optional string rwbs = 4;
3012  optional string comm = 5;
3013}
3014message BlockSplitFtraceEvent {
3015  optional uint64 dev = 1;
3016  optional uint64 sector = 2;
3017  optional uint64 new_sector = 3;
3018  optional string rwbs = 4;
3019  optional string comm = 5;
3020}
3021message BlockTouchBufferFtraceEvent {
3022  optional uint64 dev = 1;
3023  optional uint64 sector = 2;
3024  optional uint64 size = 3;
3025}
3026message BlockUnplugFtraceEvent {
3027  optional int32 nr_rq = 1;
3028  optional string comm = 2;
3029}
3030
3031// End of protos/perfetto/trace/ftrace/block.proto
3032
3033// Begin of protos/perfetto/trace/ftrace/cgroup.proto
3034
3035message CgroupAttachTaskFtraceEvent {
3036  optional int32 dst_root = 1;
3037  optional int32 dst_id = 2;
3038  optional int32 pid = 3;
3039  optional string comm = 4;
3040  optional string cname = 5;
3041}
3042message CgroupMkdirFtraceEvent {
3043  optional int32 root = 1;
3044  optional int32 id = 2;
3045  optional string cname = 3;
3046}
3047message CgroupRemountFtraceEvent {
3048  optional int32 root = 1;
3049  optional uint32 ss_mask = 2;
3050  optional string name = 3;
3051}
3052message CgroupRmdirFtraceEvent {
3053  optional int32 root = 1;
3054  optional int32 id = 2;
3055  optional string cname = 3;
3056}
3057message CgroupTransferTasksFtraceEvent {
3058  optional int32 dst_root = 1;
3059  optional int32 dst_id = 2;
3060  optional int32 pid = 3;
3061  optional string comm = 4;
3062  optional string cname = 5;
3063}
3064message CgroupDestroyRootFtraceEvent {
3065  optional int32 root = 1;
3066  optional uint32 ss_mask = 2;
3067  optional string name = 3;
3068}
3069message CgroupReleaseFtraceEvent {
3070  optional int32 root = 1;
3071  optional int32 id = 2;
3072  optional string cname = 3;
3073}
3074message CgroupRenameFtraceEvent {
3075  optional int32 root = 1;
3076  optional int32 id = 2;
3077  optional string cname = 3;
3078}
3079message CgroupSetupRootFtraceEvent {
3080  optional int32 root = 1;
3081  optional uint32 ss_mask = 2;
3082  optional string name = 3;
3083}
3084
3085// End of protos/perfetto/trace/ftrace/cgroup.proto
3086
3087// Begin of protos/perfetto/trace/ftrace/clk.proto
3088
3089message ClkEnableFtraceEvent {
3090  optional string name = 1;
3091}
3092message ClkDisableFtraceEvent {
3093  optional string name = 1;
3094}
3095message ClkSetRateFtraceEvent {
3096  optional string name = 1;
3097  optional uint64 rate = 2;
3098}
3099
3100// End of protos/perfetto/trace/ftrace/clk.proto
3101
3102// Begin of protos/perfetto/trace/ftrace/compaction.proto
3103
3104message MmCompactionBeginFtraceEvent {
3105  optional uint64 zone_start = 1;
3106  optional uint64 migrate_pfn = 2;
3107  optional uint64 free_pfn = 3;
3108  optional uint64 zone_end = 4;
3109  optional uint32 sync = 5;
3110}
3111message MmCompactionDeferCompactionFtraceEvent {
3112  optional int32 nid = 1;
3113  optional uint32 idx = 2;
3114  optional int32 order = 3;
3115  optional uint32 considered = 4;
3116  optional uint32 defer_shift = 5;
3117  optional int32 order_failed = 6;
3118}
3119message MmCompactionDeferredFtraceEvent {
3120  optional int32 nid = 1;
3121  optional uint32 idx = 2;
3122  optional int32 order = 3;
3123  optional uint32 considered = 4;
3124  optional uint32 defer_shift = 5;
3125  optional int32 order_failed = 6;
3126}
3127message MmCompactionDeferResetFtraceEvent {
3128  optional int32 nid = 1;
3129  optional uint32 idx = 2;
3130  optional int32 order = 3;
3131  optional uint32 considered = 4;
3132  optional uint32 defer_shift = 5;
3133  optional int32 order_failed = 6;
3134}
3135message MmCompactionEndFtraceEvent {
3136  optional uint64 zone_start = 1;
3137  optional uint64 migrate_pfn = 2;
3138  optional uint64 free_pfn = 3;
3139  optional uint64 zone_end = 4;
3140  optional uint32 sync = 5;
3141  optional int32 status = 6;
3142}
3143message MmCompactionFinishedFtraceEvent {
3144  optional int32 nid = 1;
3145  optional uint32 idx = 2;
3146  optional int32 order = 3;
3147  optional int32 ret = 4;
3148}
3149message MmCompactionIsolateFreepagesFtraceEvent {
3150  optional uint64 start_pfn = 1;
3151  optional uint64 end_pfn = 2;
3152  optional uint64 nr_scanned = 3;
3153  optional uint64 nr_taken = 4;
3154}
3155message MmCompactionIsolateMigratepagesFtraceEvent {
3156  optional uint64 start_pfn = 1;
3157  optional uint64 end_pfn = 2;
3158  optional uint64 nr_scanned = 3;
3159  optional uint64 nr_taken = 4;
3160}
3161message MmCompactionKcompactdSleepFtraceEvent {
3162  optional int32 nid = 1;
3163}
3164message MmCompactionKcompactdWakeFtraceEvent {
3165  optional int32 nid = 1;
3166  optional int32 order = 2;
3167  optional uint32 classzone_idx = 3;
3168}
3169message MmCompactionMigratepagesFtraceEvent {
3170  optional uint64 nr_migrated = 1;
3171  optional uint64 nr_failed = 2;
3172}
3173message MmCompactionSuitableFtraceEvent {
3174  optional int32 nid = 1;
3175  optional uint32 idx = 2;
3176  optional int32 order = 3;
3177  optional int32 ret = 4;
3178}
3179message MmCompactionTryToCompactPagesFtraceEvent {
3180  optional int32 order = 1;
3181  optional uint32 gfp_mask = 2;
3182  optional uint32 mode = 3;
3183}
3184message MmCompactionWakeupKcompactdFtraceEvent {
3185  optional int32 nid = 1;
3186  optional int32 order = 2;
3187  optional uint32 classzone_idx = 3;
3188}
3189
3190// End of protos/perfetto/trace/ftrace/compaction.proto
3191
3192// Begin of protos/perfetto/trace/ftrace/cpuhp.proto
3193
3194message CpuhpExitFtraceEvent {
3195  optional uint32 cpu = 1;
3196  optional int32 idx = 2;
3197  optional int32 ret = 3;
3198  optional int32 state = 4;
3199}
3200message CpuhpMultiEnterFtraceEvent {
3201  optional uint32 cpu = 1;
3202  optional uint64 fun = 2;
3203  optional int32 idx = 3;
3204  optional int32 target = 4;
3205}
3206message CpuhpEnterFtraceEvent {
3207  optional uint32 cpu = 1;
3208  optional uint64 fun = 2;
3209  optional int32 idx = 3;
3210  optional int32 target = 4;
3211}
3212message CpuhpLatencyFtraceEvent {
3213  optional uint32 cpu = 1;
3214  optional int32 ret = 2;
3215  optional uint32 state = 3;
3216  optional uint64 time = 4;
3217}
3218message CpuhpPauseFtraceEvent {
3219  optional uint32 active_cpus = 1;
3220  optional uint32 cpus = 2;
3221  optional uint32 pause = 3;
3222  optional uint32 time = 4;
3223}
3224
3225// End of protos/perfetto/trace/ftrace/cpuhp.proto
3226
3227// Begin of protos/perfetto/trace/ftrace/dmabuf_heap.proto
3228
3229message DmaHeapStatFtraceEvent {
3230  optional uint64 inode = 1;
3231  optional int64 len = 2;
3232  optional uint64 total_allocated = 3;
3233}
3234
3235// End of protos/perfetto/trace/ftrace/dmabuf_heap.proto
3236
3237// Begin of protos/perfetto/trace/ftrace/dpu.proto
3238
3239message DpuTracingMarkWriteFtraceEvent {
3240  optional int32 pid = 1;
3241  optional string trace_name = 2;
3242  optional uint32 trace_begin = 3;
3243  optional string name = 4;
3244  optional uint32 type = 5;
3245  optional int32 value = 6;
3246}
3247
3248// End of protos/perfetto/trace/ftrace/dpu.proto
3249
3250// Begin of protos/perfetto/trace/ftrace/ext4.proto
3251
3252message Ext4DaWriteBeginFtraceEvent {
3253  optional uint64 dev = 1;
3254  optional uint64 ino = 2;
3255  optional int64 pos = 3;
3256  optional uint32 len = 4;
3257  optional uint32 flags = 5;
3258}
3259message Ext4DaWriteEndFtraceEvent {
3260  optional uint64 dev = 1;
3261  optional uint64 ino = 2;
3262  optional int64 pos = 3;
3263  optional uint32 len = 4;
3264  optional uint32 copied = 5;
3265}
3266message Ext4SyncFileEnterFtraceEvent {
3267  optional uint64 dev = 1;
3268  optional uint64 ino = 2;
3269  optional uint64 parent = 3;
3270  optional int32 datasync = 4;
3271}
3272message Ext4SyncFileExitFtraceEvent {
3273  optional uint64 dev = 1;
3274  optional uint64 ino = 2;
3275  optional int32 ret = 3;
3276}
3277message Ext4AllocDaBlocksFtraceEvent {
3278  optional uint64 dev = 1;
3279  optional uint64 ino = 2;
3280  optional uint32 data_blocks = 3;
3281  optional uint32 meta_blocks = 4;
3282}
3283message Ext4AllocateBlocksFtraceEvent {
3284  optional uint64 dev = 1;
3285  optional uint64 ino = 2;
3286  optional uint64 block = 3;
3287  optional uint32 len = 4;
3288  optional uint32 logical = 5;
3289  optional uint32 lleft = 6;
3290  optional uint32 lright = 7;
3291  optional uint64 goal = 8;
3292  optional uint64 pleft = 9;
3293  optional uint64 pright = 10;
3294  optional uint32 flags = 11;
3295}
3296message Ext4AllocateInodeFtraceEvent {
3297  optional uint64 dev = 1;
3298  optional uint64 ino = 2;
3299  optional uint64 dir = 3;
3300  optional uint32 mode = 4;
3301}
3302message Ext4BeginOrderedTruncateFtraceEvent {
3303  optional uint64 dev = 1;
3304  optional uint64 ino = 2;
3305  optional int64 new_size = 3;
3306}
3307message Ext4CollapseRangeFtraceEvent {
3308  optional uint64 dev = 1;
3309  optional uint64 ino = 2;
3310  optional int64 offset = 3;
3311  optional int64 len = 4;
3312}
3313message Ext4DaReleaseSpaceFtraceEvent {
3314  optional uint64 dev = 1;
3315  optional uint64 ino = 2;
3316  optional uint64 i_blocks = 3;
3317  optional int32 freed_blocks = 4;
3318  optional int32 reserved_data_blocks = 5;
3319  optional int32 reserved_meta_blocks = 6;
3320  optional int32 allocated_meta_blocks = 7;
3321  optional uint32 mode = 8;
3322}
3323message Ext4DaReserveSpaceFtraceEvent {
3324  optional uint64 dev = 1;
3325  optional uint64 ino = 2;
3326  optional uint64 i_blocks = 3;
3327  optional int32 reserved_data_blocks = 4;
3328  optional int32 reserved_meta_blocks = 5;
3329  optional uint32 mode = 6;
3330  optional int32 md_needed = 7;
3331}
3332message Ext4DaUpdateReserveSpaceFtraceEvent {
3333  optional uint64 dev = 1;
3334  optional uint64 ino = 2;
3335  optional uint64 i_blocks = 3;
3336  optional int32 used_blocks = 4;
3337  optional int32 reserved_data_blocks = 5;
3338  optional int32 reserved_meta_blocks = 6;
3339  optional int32 allocated_meta_blocks = 7;
3340  optional int32 quota_claim = 8;
3341  optional uint32 mode = 9;
3342}
3343message Ext4DaWritePagesFtraceEvent {
3344  optional uint64 dev = 1;
3345  optional uint64 ino = 2;
3346  optional uint64 first_page = 3;
3347  optional int64 nr_to_write = 4;
3348  optional int32 sync_mode = 5;
3349  optional uint64 b_blocknr = 6;
3350  optional uint32 b_size = 7;
3351  optional uint32 b_state = 8;
3352  optional int32 io_done = 9;
3353  optional int32 pages_written = 10;
3354}
3355message Ext4DaWritePagesExtentFtraceEvent {
3356  optional uint64 dev = 1;
3357  optional uint64 ino = 2;
3358  optional uint64 lblk = 3;
3359  optional uint32 len = 4;
3360  optional uint32 flags = 5;
3361}
3362message Ext4DirectIOEnterFtraceEvent {
3363  optional uint64 dev = 1;
3364  optional uint64 ino = 2;
3365  optional int64 pos = 3;
3366  optional uint64 len = 4;
3367  optional int32 rw = 5;
3368}
3369message Ext4DirectIOExitFtraceEvent {
3370  optional uint64 dev = 1;
3371  optional uint64 ino = 2;
3372  optional int64 pos = 3;
3373  optional uint64 len = 4;
3374  optional int32 rw = 5;
3375  optional int32 ret = 6;
3376}
3377message Ext4DiscardBlocksFtraceEvent {
3378  optional uint64 dev = 1;
3379  optional uint64 blk = 2;
3380  optional uint64 count = 3;
3381}
3382message Ext4DiscardPreallocationsFtraceEvent {
3383  optional uint64 dev = 1;
3384  optional uint64 ino = 2;
3385}
3386message Ext4DropInodeFtraceEvent {
3387  optional uint64 dev = 1;
3388  optional uint64 ino = 2;
3389  optional int32 drop = 3;
3390}
3391message Ext4EsCacheExtentFtraceEvent {
3392  optional uint64 dev = 1;
3393  optional uint64 ino = 2;
3394  optional uint32 lblk = 3;
3395  optional uint32 len = 4;
3396  optional uint64 pblk = 5;
3397  optional uint32 status = 6;
3398}
3399message Ext4EsFindDelayedExtentRangeEnterFtraceEvent {
3400  optional uint64 dev = 1;
3401  optional uint64 ino = 2;
3402  optional uint32 lblk = 3;
3403}
3404message Ext4EsFindDelayedExtentRangeExitFtraceEvent {
3405  optional uint64 dev = 1;
3406  optional uint64 ino = 2;
3407  optional uint32 lblk = 3;
3408  optional uint32 len = 4;
3409  optional uint64 pblk = 5;
3410  optional uint64 status = 6;
3411}
3412message Ext4EsInsertExtentFtraceEvent {
3413  optional uint64 dev = 1;
3414  optional uint64 ino = 2;
3415  optional uint32 lblk = 3;
3416  optional uint32 len = 4;
3417  optional uint64 pblk = 5;
3418  optional uint64 status = 6;
3419}
3420message Ext4EsLookupExtentEnterFtraceEvent {
3421  optional uint64 dev = 1;
3422  optional uint64 ino = 2;
3423  optional uint32 lblk = 3;
3424}
3425message Ext4EsLookupExtentExitFtraceEvent {
3426  optional uint64 dev = 1;
3427  optional uint64 ino = 2;
3428  optional uint32 lblk = 3;
3429  optional uint32 len = 4;
3430  optional uint64 pblk = 5;
3431  optional uint64 status = 6;
3432  optional int32 found = 7;
3433}
3434message Ext4EsRemoveExtentFtraceEvent {
3435  optional uint64 dev = 1;
3436  optional uint64 ino = 2;
3437  optional int64 lblk = 3;
3438  optional int64 len = 4;
3439}
3440message Ext4EsShrinkFtraceEvent {
3441  optional uint64 dev = 1;
3442  optional int32 nr_shrunk = 2;
3443  optional uint64 scan_time = 3;
3444  optional int32 nr_skipped = 4;
3445  optional int32 retried = 5;
3446}
3447message Ext4EsShrinkCountFtraceEvent {
3448  optional uint64 dev = 1;
3449  optional int32 nr_to_scan = 2;
3450  optional int32 cache_cnt = 3;
3451}
3452message Ext4EsShrinkScanEnterFtraceEvent {
3453  optional uint64 dev = 1;
3454  optional int32 nr_to_scan = 2;
3455  optional int32 cache_cnt = 3;
3456}
3457message Ext4EsShrinkScanExitFtraceEvent {
3458  optional uint64 dev = 1;
3459  optional int32 nr_shrunk = 2;
3460  optional int32 cache_cnt = 3;
3461}
3462message Ext4EvictInodeFtraceEvent {
3463  optional uint64 dev = 1;
3464  optional uint64 ino = 2;
3465  optional int32 nlink = 3;
3466}
3467message Ext4ExtConvertToInitializedEnterFtraceEvent {
3468  optional uint64 dev = 1;
3469  optional uint64 ino = 2;
3470  optional uint32 m_lblk = 3;
3471  optional uint32 m_len = 4;
3472  optional uint32 u_lblk = 5;
3473  optional uint32 u_len = 6;
3474  optional uint64 u_pblk = 7;
3475}
3476message Ext4ExtConvertToInitializedFastpathFtraceEvent {
3477  optional uint64 dev = 1;
3478  optional uint64 ino = 2;
3479  optional uint32 m_lblk = 3;
3480  optional uint32 m_len = 4;
3481  optional uint32 u_lblk = 5;
3482  optional uint32 u_len = 6;
3483  optional uint64 u_pblk = 7;
3484  optional uint32 i_lblk = 8;
3485  optional uint32 i_len = 9;
3486  optional uint64 i_pblk = 10;
3487}
3488message Ext4ExtHandleUnwrittenExtentsFtraceEvent {
3489  optional uint64 dev = 1;
3490  optional uint64 ino = 2;
3491  optional int32 flags = 3;
3492  optional uint32 lblk = 4;
3493  optional uint64 pblk = 5;
3494  optional uint32 len = 6;
3495  optional uint32 allocated = 7;
3496  optional uint64 newblk = 8;
3497}
3498message Ext4ExtInCacheFtraceEvent {
3499  optional uint64 dev = 1;
3500  optional uint64 ino = 2;
3501  optional uint32 lblk = 3;
3502  optional int32 ret = 4;
3503}
3504message Ext4ExtLoadExtentFtraceEvent {
3505  optional uint64 dev = 1;
3506  optional uint64 ino = 2;
3507  optional uint64 pblk = 3;
3508  optional uint32 lblk = 4;
3509}
3510message Ext4ExtMapBlocksEnterFtraceEvent {
3511  optional uint64 dev = 1;
3512  optional uint64 ino = 2;
3513  optional uint32 lblk = 3;
3514  optional uint32 len = 4;
3515  optional uint32 flags = 5;
3516}
3517message Ext4ExtMapBlocksExitFtraceEvent {
3518  optional uint64 dev = 1;
3519  optional uint64 ino = 2;
3520  optional uint32 flags = 3;
3521  optional uint64 pblk = 4;
3522  optional uint32 lblk = 5;
3523  optional uint32 len = 6;
3524  optional uint32 mflags = 7;
3525  optional int32 ret = 8;
3526}
3527message Ext4ExtPutInCacheFtraceEvent {
3528  optional uint64 dev = 1;
3529  optional uint64 ino = 2;
3530  optional uint32 lblk = 3;
3531  optional uint32 len = 4;
3532  optional uint64 start = 5;
3533}
3534message Ext4ExtRemoveSpaceFtraceEvent {
3535  optional uint64 dev = 1;
3536  optional uint64 ino = 2;
3537  optional uint32 start = 3;
3538  optional uint32 end = 4;
3539  optional int32 depth = 5;
3540}
3541message Ext4ExtRemoveSpaceDoneFtraceEvent {
3542  optional uint64 dev = 1;
3543  optional uint64 ino = 2;
3544  optional uint32 start = 3;
3545  optional uint32 end = 4;
3546  optional int32 depth = 5;
3547  optional int64 partial = 6;
3548  optional uint32 eh_entries = 7;
3549}
3550message Ext4ExtRmIdxFtraceEvent {
3551  optional uint64 dev = 1;
3552  optional uint64 ino = 2;
3553  optional uint64 pblk = 3;
3554}
3555message Ext4ExtRmLeafFtraceEvent {
3556  optional uint64 dev = 1;
3557  optional uint64 ino = 2;
3558  optional int64 partial = 3;
3559  optional uint32 start = 4;
3560  optional uint32 ee_lblk = 5;
3561  optional uint64 ee_pblk = 6;
3562  optional int32 ee_len = 7;
3563}
3564message Ext4ExtShowExtentFtraceEvent {
3565  optional uint64 dev = 1;
3566  optional uint64 ino = 2;
3567  optional uint64 pblk = 3;
3568  optional uint32 lblk = 4;
3569  optional uint32 len = 5;
3570}
3571message Ext4FallocateEnterFtraceEvent {
3572  optional uint64 dev = 1;
3573  optional uint64 ino = 2;
3574  optional int64 offset = 3;
3575  optional int64 len = 4;
3576  optional int32 mode = 5;
3577  optional int64 pos = 6;
3578}
3579message Ext4FallocateExitFtraceEvent {
3580  optional uint64 dev = 1;
3581  optional uint64 ino = 2;
3582  optional int64 pos = 3;
3583  optional uint32 blocks = 4;
3584  optional int32 ret = 5;
3585}
3586message Ext4FindDelallocRangeFtraceEvent {
3587  optional uint64 dev = 1;
3588  optional uint64 ino = 2;
3589  optional uint32 from = 3;
3590  optional uint32 to = 4;
3591  optional int32 reverse = 5;
3592  optional int32 found = 6;
3593  optional uint32 found_blk = 7;
3594}
3595message Ext4ForgetFtraceEvent {
3596  optional uint64 dev = 1;
3597  optional uint64 ino = 2;
3598  optional uint64 block = 3;
3599  optional int32 is_metadata = 4;
3600  optional uint32 mode = 5;
3601}
3602message Ext4FreeBlocksFtraceEvent {
3603  optional uint64 dev = 1;
3604  optional uint64 ino = 2;
3605  optional uint64 block = 3;
3606  optional uint64 count = 4;
3607  optional int32 flags = 5;
3608  optional uint32 mode = 6;
3609}
3610message Ext4FreeInodeFtraceEvent {
3611  optional uint64 dev = 1;
3612  optional uint64 ino = 2;
3613  optional uint32 uid = 3;
3614  optional uint32 gid = 4;
3615  optional uint64 blocks = 5;
3616  optional uint32 mode = 6;
3617}
3618message Ext4GetImpliedClusterAllocExitFtraceEvent {
3619  optional uint64 dev = 1;
3620  optional uint32 flags = 2;
3621  optional uint32 lblk = 3;
3622  optional uint64 pblk = 4;
3623  optional uint32 len = 5;
3624  optional int32 ret = 6;
3625}
3626message Ext4GetReservedClusterAllocFtraceEvent {
3627  optional uint64 dev = 1;
3628  optional uint64 ino = 2;
3629  optional uint32 lblk = 3;
3630  optional uint32 len = 4;
3631}
3632message Ext4IndMapBlocksEnterFtraceEvent {
3633  optional uint64 dev = 1;
3634  optional uint64 ino = 2;
3635  optional uint32 lblk = 3;
3636  optional uint32 len = 4;
3637  optional uint32 flags = 5;
3638}
3639message Ext4IndMapBlocksExitFtraceEvent {
3640  optional uint64 dev = 1;
3641  optional uint64 ino = 2;
3642  optional uint32 flags = 3;
3643  optional uint64 pblk = 4;
3644  optional uint32 lblk = 5;
3645  optional uint32 len = 6;
3646  optional uint32 mflags = 7;
3647  optional int32 ret = 8;
3648}
3649message Ext4InsertRangeFtraceEvent {
3650  optional uint64 dev = 1;
3651  optional uint64 ino = 2;
3652  optional int64 offset = 3;
3653  optional int64 len = 4;
3654}
3655message Ext4InvalidatepageFtraceEvent {
3656  optional uint64 dev = 1;
3657  optional uint64 ino = 2;
3658  optional uint64 index = 3;
3659  optional uint64 offset = 4;
3660  optional uint32 length = 5;
3661}
3662message Ext4JournalStartFtraceEvent {
3663  optional uint64 dev = 1;
3664  optional uint64 ip = 2;
3665  optional int32 blocks = 3;
3666  optional int32 rsv_blocks = 4;
3667  optional int32 nblocks = 5;
3668}
3669message Ext4JournalStartReservedFtraceEvent {
3670  optional uint64 dev = 1;
3671  optional uint64 ip = 2;
3672  optional int32 blocks = 3;
3673}
3674message Ext4JournalledInvalidatepageFtraceEvent {
3675  optional uint64 dev = 1;
3676  optional uint64 ino = 2;
3677  optional uint64 index = 3;
3678  optional uint64 offset = 4;
3679  optional uint32 length = 5;
3680}
3681message Ext4JournalledWriteEndFtraceEvent {
3682  optional uint64 dev = 1;
3683  optional uint64 ino = 2;
3684  optional int64 pos = 3;
3685  optional uint32 len = 4;
3686  optional uint32 copied = 5;
3687}
3688message Ext4LoadInodeFtraceEvent {
3689  optional uint64 dev = 1;
3690  optional uint64 ino = 2;
3691}
3692message Ext4LoadInodeBitmapFtraceEvent {
3693  optional uint64 dev = 1;
3694  optional uint32 group = 2;
3695}
3696message Ext4MarkInodeDirtyFtraceEvent {
3697  optional uint64 dev = 1;
3698  optional uint64 ino = 2;
3699  optional uint64 ip = 3;
3700}
3701message Ext4MbBitmapLoadFtraceEvent {
3702  optional uint64 dev = 1;
3703  optional uint32 group = 2;
3704}
3705message Ext4MbBuddyBitmapLoadFtraceEvent {
3706  optional uint64 dev = 1;
3707  optional uint32 group = 2;
3708}
3709message Ext4MbDiscardPreallocationsFtraceEvent {
3710  optional uint64 dev = 1;
3711  optional int32 needed = 2;
3712}
3713message Ext4MbNewGroupPaFtraceEvent {
3714  optional uint64 dev = 1;
3715  optional uint64 ino = 2;
3716  optional uint64 pa_pstart = 3;
3717  optional uint64 pa_lstart = 4;
3718  optional uint32 pa_len = 5;
3719}
3720message Ext4MbNewInodePaFtraceEvent {
3721  optional uint64 dev = 1;
3722  optional uint64 ino = 2;
3723  optional uint64 pa_pstart = 3;
3724  optional uint64 pa_lstart = 4;
3725  optional uint32 pa_len = 5;
3726}
3727message Ext4MbReleaseGroupPaFtraceEvent {
3728  optional uint64 dev = 1;
3729  optional uint64 pa_pstart = 2;
3730  optional uint32 pa_len = 3;
3731}
3732message Ext4MbReleaseInodePaFtraceEvent {
3733  optional uint64 dev = 1;
3734  optional uint64 ino = 2;
3735  optional uint64 block = 3;
3736  optional uint32 count = 4;
3737}
3738message Ext4MballocAllocFtraceEvent {
3739  optional uint64 dev = 1;
3740  optional uint64 ino = 2;
3741  optional uint32 orig_logical = 3;
3742  optional int32 orig_start = 4;
3743  optional uint32 orig_group = 5;
3744  optional int32 orig_len = 6;
3745  optional uint32 goal_logical = 7;
3746  optional int32 goal_start = 8;
3747  optional uint32 goal_group = 9;
3748  optional int32 goal_len = 10;
3749  optional uint32 result_logical = 11;
3750  optional int32 result_start = 12;
3751  optional uint32 result_group = 13;
3752  optional int32 result_len = 14;
3753  optional uint32 found = 15;
3754  optional uint32 groups = 16;
3755  optional uint32 buddy = 17;
3756  optional uint32 flags = 18;
3757  optional uint32 tail = 19;
3758  optional uint32 cr = 20;
3759}
3760message Ext4MballocDiscardFtraceEvent {
3761  optional uint64 dev = 1;
3762  optional uint64 ino = 2;
3763  optional int32 result_start = 3;
3764  optional uint32 result_group = 4;
3765  optional int32 result_len = 5;
3766}
3767message Ext4MballocFreeFtraceEvent {
3768  optional uint64 dev = 1;
3769  optional uint64 ino = 2;
3770  optional int32 result_start = 3;
3771  optional uint32 result_group = 4;
3772  optional int32 result_len = 5;
3773}
3774message Ext4MballocPreallocFtraceEvent {
3775  optional uint64 dev = 1;
3776  optional uint64 ino = 2;
3777  optional uint32 orig_logical = 3;
3778  optional int32 orig_start = 4;
3779  optional uint32 orig_group = 5;
3780  optional int32 orig_len = 6;
3781  optional uint32 result_logical = 7;
3782  optional int32 result_start = 8;
3783  optional uint32 result_group = 9;
3784  optional int32 result_len = 10;
3785}
3786message Ext4OtherInodeUpdateTimeFtraceEvent {
3787  optional uint64 dev = 1;
3788  optional uint64 ino = 2;
3789  optional uint64 orig_ino = 3;
3790  optional uint32 uid = 4;
3791  optional uint32 gid = 5;
3792  optional uint32 mode = 6;
3793}
3794message Ext4PunchHoleFtraceEvent {
3795  optional uint64 dev = 1;
3796  optional uint64 ino = 2;
3797  optional int64 offset = 3;
3798  optional int64 len = 4;
3799  optional int32 mode = 5;
3800}
3801message Ext4ReadBlockBitmapLoadFtraceEvent {
3802  optional uint64 dev = 1;
3803  optional uint32 group = 2;
3804}
3805message Ext4ReadpageFtraceEvent {
3806  optional uint64 dev = 1;
3807  optional uint64 ino = 2;
3808  optional uint64 index = 3;
3809}
3810message Ext4ReleasepageFtraceEvent {
3811  optional uint64 dev = 1;
3812  optional uint64 ino = 2;
3813  optional uint64 index = 3;
3814}
3815message Ext4RemoveBlocksFtraceEvent {
3816  optional uint64 dev = 1;
3817  optional uint64 ino = 2;
3818  optional uint32 from = 3;
3819  optional uint32 to = 4;
3820  optional int64 partial = 5;
3821  optional uint64 ee_pblk = 6;
3822  optional uint32 ee_lblk = 7;
3823  optional uint32 ee_len = 8;
3824}
3825message Ext4RequestBlocksFtraceEvent {
3826  optional uint64 dev = 1;
3827  optional uint64 ino = 2;
3828  optional uint32 len = 3;
3829  optional uint32 logical = 4;
3830  optional uint32 lleft = 5;
3831  optional uint32 lright = 6;
3832  optional uint64 goal = 7;
3833  optional uint64 pleft = 8;
3834  optional uint64 pright = 9;
3835  optional uint32 flags = 10;
3836}
3837message Ext4RequestInodeFtraceEvent {
3838  optional uint64 dev = 1;
3839  optional uint64 dir = 2;
3840  optional uint32 mode = 3;
3841}
3842message Ext4SyncFsFtraceEvent {
3843  optional uint64 dev = 1;
3844  optional int32 wait = 2;
3845}
3846message Ext4TrimAllFreeFtraceEvent {
3847  optional int32 dev_major = 1;
3848  optional int32 dev_minor = 2;
3849  optional uint32 group = 3;
3850  optional int32 start = 4;
3851  optional int32 len = 5;
3852}
3853message Ext4TrimExtentFtraceEvent {
3854  optional int32 dev_major = 1;
3855  optional int32 dev_minor = 2;
3856  optional uint32 group = 3;
3857  optional int32 start = 4;
3858  optional int32 len = 5;
3859}
3860message Ext4TruncateEnterFtraceEvent {
3861  optional uint64 dev = 1;
3862  optional uint64 ino = 2;
3863  optional uint64 blocks = 3;
3864}
3865message Ext4TruncateExitFtraceEvent {
3866  optional uint64 dev = 1;
3867  optional uint64 ino = 2;
3868  optional uint64 blocks = 3;
3869}
3870message Ext4UnlinkEnterFtraceEvent {
3871  optional uint64 dev = 1;
3872  optional uint64 ino = 2;
3873  optional uint64 parent = 3;
3874  optional int64 size = 4;
3875}
3876message Ext4UnlinkExitFtraceEvent {
3877  optional uint64 dev = 1;
3878  optional uint64 ino = 2;
3879  optional int32 ret = 3;
3880}
3881message Ext4WriteBeginFtraceEvent {
3882  optional uint64 dev = 1;
3883  optional uint64 ino = 2;
3884  optional int64 pos = 3;
3885  optional uint32 len = 4;
3886  optional uint32 flags = 5;
3887}
3888message Ext4WriteEndFtraceEvent {
3889  optional uint64 dev = 1;
3890  optional uint64 ino = 2;
3891  optional int64 pos = 3;
3892  optional uint32 len = 4;
3893  optional uint32 copied = 5;
3894}
3895message Ext4WritepageFtraceEvent {
3896  optional uint64 dev = 1;
3897  optional uint64 ino = 2;
3898  optional uint64 index = 3;
3899}
3900message Ext4WritepagesFtraceEvent {
3901  optional uint64 dev = 1;
3902  optional uint64 ino = 2;
3903  optional int64 nr_to_write = 3;
3904  optional int64 pages_skipped = 4;
3905  optional int64 range_start = 5;
3906  optional int64 range_end = 6;
3907  optional uint64 writeback_index = 7;
3908  optional int32 sync_mode = 8;
3909  optional uint32 for_kupdate = 9;
3910  optional uint32 range_cyclic = 10;
3911}
3912message Ext4WritepagesResultFtraceEvent {
3913  optional uint64 dev = 1;
3914  optional uint64 ino = 2;
3915  optional int32 ret = 3;
3916  optional int32 pages_written = 4;
3917  optional int64 pages_skipped = 5;
3918  optional uint64 writeback_index = 6;
3919  optional int32 sync_mode = 7;
3920}
3921message Ext4ZeroRangeFtraceEvent {
3922  optional uint64 dev = 1;
3923  optional uint64 ino = 2;
3924  optional int64 offset = 3;
3925  optional int64 len = 4;
3926  optional int32 mode = 5;
3927}
3928
3929// End of protos/perfetto/trace/ftrace/ext4.proto
3930
3931// Begin of protos/perfetto/trace/ftrace/f2fs.proto
3932
3933message F2fsDoSubmitBioFtraceEvent {
3934  optional uint64 dev = 1;
3935  optional int32 btype = 2;
3936  optional uint32 sync = 3;
3937  optional uint64 sector = 4;
3938  optional uint32 size = 5;
3939}
3940message F2fsEvictInodeFtraceEvent {
3941  optional uint64 dev = 1;
3942  optional uint64 ino = 2;
3943  optional uint64 pino = 3;
3944  optional uint32 mode = 4;
3945  optional int64 size = 5;
3946  optional uint32 nlink = 6;
3947  optional uint64 blocks = 7;
3948  optional uint32 advise = 8;
3949}
3950message F2fsFallocateFtraceEvent {
3951  optional uint64 dev = 1;
3952  optional uint64 ino = 2;
3953  optional int32 mode = 3;
3954  optional int64 offset = 4;
3955  optional int64 len = 5;
3956  optional int64 size = 6;
3957  optional uint64 blocks = 7;
3958  optional int32 ret = 8;
3959}
3960message F2fsGetDataBlockFtraceEvent {
3961  optional uint64 dev = 1;
3962  optional uint64 ino = 2;
3963  optional uint64 iblock = 3;
3964  optional uint64 bh_start = 4;
3965  optional uint64 bh_size = 5;
3966  optional int32 ret = 6;
3967}
3968message F2fsGetVictimFtraceEvent {
3969  optional uint64 dev = 1;
3970  optional int32 type = 2;
3971  optional int32 gc_type = 3;
3972  optional int32 alloc_mode = 4;
3973  optional int32 gc_mode = 5;
3974  optional uint32 victim = 6;
3975  optional uint32 ofs_unit = 7;
3976  optional uint32 pre_victim = 8;
3977  optional uint32 prefree = 9;
3978  optional uint32 free = 10;
3979}
3980message F2fsIgetFtraceEvent {
3981  optional uint64 dev = 1;
3982  optional uint64 ino = 2;
3983  optional uint64 pino = 3;
3984  optional uint32 mode = 4;
3985  optional int64 size = 5;
3986  optional uint32 nlink = 6;
3987  optional uint64 blocks = 7;
3988  optional uint32 advise = 8;
3989}
3990message F2fsIgetExitFtraceEvent {
3991  optional uint64 dev = 1;
3992  optional uint64 ino = 2;
3993  optional int32 ret = 3;
3994}
3995message F2fsNewInodeFtraceEvent {
3996  optional uint64 dev = 1;
3997  optional uint64 ino = 2;
3998  optional int32 ret = 3;
3999}
4000message F2fsReadpageFtraceEvent {
4001  optional uint64 dev = 1;
4002  optional uint64 ino = 2;
4003  optional uint64 index = 3;
4004  optional uint64 blkaddr = 4;
4005  optional int32 type = 5;
4006}
4007message F2fsReserveNewBlockFtraceEvent {
4008  optional uint64 dev = 1;
4009  optional uint32 nid = 2;
4010  optional uint32 ofs_in_node = 3;
4011}
4012message F2fsSetPageDirtyFtraceEvent {
4013  optional uint64 dev = 1;
4014  optional uint64 ino = 2;
4015  optional int32 type = 3;
4016  optional int32 dir = 4;
4017  optional uint64 index = 5;
4018  optional int32 dirty = 6;
4019}
4020message F2fsSubmitWritePageFtraceEvent {
4021  optional uint64 dev = 1;
4022  optional uint64 ino = 2;
4023  optional int32 type = 3;
4024  optional uint64 index = 4;
4025  optional uint32 block = 5;
4026}
4027message F2fsSyncFileEnterFtraceEvent {
4028  optional uint64 dev = 1;
4029  optional uint64 ino = 2;
4030  optional uint64 pino = 3;
4031  optional uint32 mode = 4;
4032  optional int64 size = 5;
4033  optional uint32 nlink = 6;
4034  optional uint64 blocks = 7;
4035  optional uint32 advise = 8;
4036}
4037message F2fsSyncFileExitFtraceEvent {
4038  optional uint64 dev = 1;
4039  optional uint64 ino = 2;
4040  optional uint32 need_cp = 3;
4041  optional int32 datasync = 4;
4042  optional int32 ret = 5;
4043}
4044message F2fsSyncFsFtraceEvent {
4045  optional uint64 dev = 1;
4046  optional int32 dirty = 2;
4047  optional int32 wait = 3;
4048}
4049message F2fsTruncateFtraceEvent {
4050  optional uint64 dev = 1;
4051  optional uint64 ino = 2;
4052  optional uint64 pino = 3;
4053  optional uint32 mode = 4;
4054  optional int64 size = 5;
4055  optional uint32 nlink = 6;
4056  optional uint64 blocks = 7;
4057  optional uint32 advise = 8;
4058}
4059message F2fsTruncateBlocksEnterFtraceEvent {
4060  optional uint64 dev = 1;
4061  optional uint64 ino = 2;
4062  optional int64 size = 3;
4063  optional uint64 blocks = 4;
4064  optional uint64 from = 5;
4065}
4066message F2fsTruncateBlocksExitFtraceEvent {
4067  optional uint64 dev = 1;
4068  optional uint64 ino = 2;
4069  optional int32 ret = 3;
4070}
4071message F2fsTruncateDataBlocksRangeFtraceEvent {
4072  optional uint64 dev = 1;
4073  optional uint64 ino = 2;
4074  optional uint32 nid = 3;
4075  optional uint32 ofs = 4;
4076  optional int32 free = 5;
4077}
4078message F2fsTruncateInodeBlocksEnterFtraceEvent {
4079  optional uint64 dev = 1;
4080  optional uint64 ino = 2;
4081  optional int64 size = 3;
4082  optional uint64 blocks = 4;
4083  optional uint64 from = 5;
4084}
4085message F2fsTruncateInodeBlocksExitFtraceEvent {
4086  optional uint64 dev = 1;
4087  optional uint64 ino = 2;
4088  optional int32 ret = 3;
4089}
4090message F2fsTruncateNodeFtraceEvent {
4091  optional uint64 dev = 1;
4092  optional uint64 ino = 2;
4093  optional uint32 nid = 3;
4094  optional uint32 blk_addr = 4;
4095}
4096message F2fsTruncateNodesEnterFtraceEvent {
4097  optional uint64 dev = 1;
4098  optional uint64 ino = 2;
4099  optional uint32 nid = 3;
4100  optional uint32 blk_addr = 4;
4101}
4102message F2fsTruncateNodesExitFtraceEvent {
4103  optional uint64 dev = 1;
4104  optional uint64 ino = 2;
4105  optional int32 ret = 3;
4106}
4107message F2fsTruncatePartialNodesFtraceEvent {
4108  optional uint64 dev = 1;
4109  optional uint64 ino = 2;
4110  optional uint32 nid = 3;
4111  optional int32 depth = 4;
4112  optional int32 err = 5;
4113}
4114message F2fsUnlinkEnterFtraceEvent {
4115  optional uint64 dev = 1;
4116  optional uint64 ino = 2;
4117  optional int64 size = 3;
4118  optional uint64 blocks = 4;
4119  optional string name = 5;
4120}
4121message F2fsUnlinkExitFtraceEvent {
4122  optional uint64 dev = 1;
4123  optional uint64 ino = 2;
4124  optional int32 ret = 3;
4125}
4126message F2fsVmPageMkwriteFtraceEvent {
4127  optional uint64 dev = 1;
4128  optional uint64 ino = 2;
4129  optional int32 type = 3;
4130  optional int32 dir = 4;
4131  optional uint64 index = 5;
4132  optional int32 dirty = 6;
4133}
4134message F2fsWriteBeginFtraceEvent {
4135  optional uint64 dev = 1;
4136  optional uint64 ino = 2;
4137  optional int64 pos = 3;
4138  optional uint32 len = 4;
4139  optional uint32 flags = 5;
4140}
4141message F2fsWriteCheckpointFtraceEvent {
4142  optional uint64 dev = 1;
4143  optional uint32 is_umount = 2;
4144  optional string msg = 3;
4145}
4146message F2fsWriteEndFtraceEvent {
4147  optional uint64 dev = 1;
4148  optional uint64 ino = 2;
4149  optional int64 pos = 3;
4150  optional uint32 len = 4;
4151  optional uint32 copied = 5;
4152}
4153
4154// End of protos/perfetto/trace/ftrace/f2fs.proto
4155
4156// Begin of protos/perfetto/trace/ftrace/fastrpc.proto
4157
4158message FastrpcDmaStatFtraceEvent {
4159  optional int32 cid = 1;
4160  optional int64 len = 2;
4161  optional uint64 total_allocated = 3;
4162}
4163
4164// End of protos/perfetto/trace/ftrace/fastrpc.proto
4165
4166// Begin of protos/perfetto/trace/ftrace/fence.proto
4167
4168message FenceInitFtraceEvent {
4169  optional uint32 context = 1;
4170  optional string driver = 2;
4171  optional uint32 seqno = 3;
4172  optional string timeline = 4;
4173}
4174message FenceDestroyFtraceEvent {
4175  optional uint32 context = 1;
4176  optional string driver = 2;
4177  optional uint32 seqno = 3;
4178  optional string timeline = 4;
4179}
4180message FenceEnableSignalFtraceEvent {
4181  optional uint32 context = 1;
4182  optional string driver = 2;
4183  optional uint32 seqno = 3;
4184  optional string timeline = 4;
4185}
4186message FenceSignaledFtraceEvent {
4187  optional uint32 context = 1;
4188  optional string driver = 2;
4189  optional uint32 seqno = 3;
4190  optional string timeline = 4;
4191}
4192
4193// End of protos/perfetto/trace/ftrace/fence.proto
4194
4195// Begin of protos/perfetto/trace/ftrace/filemap.proto
4196
4197message MmFilemapAddToPageCacheFtraceEvent {
4198  optional uint64 pfn = 1;
4199  optional uint64 i_ino = 2;
4200  optional uint64 index = 3;
4201  optional uint64 s_dev = 4;
4202  optional uint64 page = 5;
4203}
4204message MmFilemapDeleteFromPageCacheFtraceEvent {
4205  optional uint64 pfn = 1;
4206  optional uint64 i_ino = 2;
4207  optional uint64 index = 3;
4208  optional uint64 s_dev = 4;
4209  optional uint64 page = 5;
4210}
4211
4212// End of protos/perfetto/trace/ftrace/filemap.proto
4213
4214// Begin of protos/perfetto/trace/ftrace/ftrace.proto
4215
4216message PrintFtraceEvent {
4217  optional uint64 ip = 1;
4218  optional string buf = 2;
4219}
4220
4221// End of protos/perfetto/trace/ftrace/ftrace.proto
4222
4223// Begin of protos/perfetto/trace/ftrace/g2d.proto
4224
4225message G2dTracingMarkWriteFtraceEvent {
4226  optional int32 pid = 1;
4227  optional string name = 4;
4228  optional uint32 type = 5;
4229  optional int32 value = 6;
4230}
4231
4232// End of protos/perfetto/trace/ftrace/g2d.proto
4233
4234// Begin of protos/perfetto/trace/ftrace/generic.proto
4235
4236// This generic proto is used to output events in the trace
4237// when a specific proto for that event does not exist.
4238message GenericFtraceEvent {
4239  message Field {
4240    optional string name = 1;
4241    oneof value {
4242      string str_value = 3;
4243      int64 int_value = 4;
4244      uint64 uint_value = 5;
4245    }
4246  }
4247
4248  optional string event_name = 1;
4249  repeated Field field = 2;
4250}
4251
4252// End of protos/perfetto/trace/ftrace/generic.proto
4253
4254// Begin of protos/perfetto/trace/ftrace/gpu_mem.proto
4255
4256message GpuMemTotalFtraceEvent {
4257  optional uint32 gpu_id = 1;
4258  optional uint32 pid = 2;
4259  optional uint64 size = 3;
4260}
4261
4262// End of protos/perfetto/trace/ftrace/gpu_mem.proto
4263
4264// Begin of protos/perfetto/trace/ftrace/i2c.proto
4265
4266message I2cReadFtraceEvent {
4267  optional int32 adapter_nr = 1;
4268  optional uint32 msg_nr = 2;
4269  optional uint32 addr = 3;
4270  optional uint32 flags = 4;
4271  optional uint32 len = 5;
4272}
4273message I2cWriteFtraceEvent {
4274  optional int32 adapter_nr = 1;
4275  optional uint32 msg_nr = 2;
4276  optional uint32 addr = 3;
4277  optional uint32 flags = 4;
4278  optional uint32 len = 5;
4279  optional uint32 buf = 6;
4280}
4281message I2cResultFtraceEvent {
4282  optional int32 adapter_nr = 1;
4283  optional uint32 nr_msgs = 2;
4284  optional int32 ret = 3;
4285}
4286message I2cReplyFtraceEvent {
4287  optional int32 adapter_nr = 1;
4288  optional uint32 msg_nr = 2;
4289  optional uint32 addr = 3;
4290  optional uint32 flags = 4;
4291  optional uint32 len = 5;
4292  optional uint32 buf = 6;
4293}
4294message SmbusReadFtraceEvent {
4295  optional int32 adapter_nr = 1;
4296  optional uint32 flags = 2;
4297  optional uint32 addr = 3;
4298  optional uint32 command = 4;
4299  optional uint32 protocol = 5;
4300}
4301message SmbusWriteFtraceEvent {
4302  optional int32 adapter_nr = 1;
4303  optional uint32 addr = 2;
4304  optional uint32 flags = 3;
4305  optional uint32 command = 4;
4306  optional uint32 len = 5;
4307  optional uint32 protocol = 6;
4308}
4309message SmbusResultFtraceEvent {
4310  optional int32 adapter_nr = 1;
4311  optional uint32 addr = 2;
4312  optional uint32 flags = 3;
4313  optional uint32 read_write = 4;
4314  optional uint32 command = 5;
4315  optional int32 res = 6;
4316  optional uint32 protocol = 7;
4317}
4318message SmbusReplyFtraceEvent {
4319  optional int32 adapter_nr = 1;
4320  optional uint32 addr = 2;
4321  optional uint32 flags = 3;
4322  optional uint32 command = 4;
4323  optional uint32 len = 5;
4324  optional uint32 protocol = 6;
4325}
4326
4327// End of protos/perfetto/trace/ftrace/i2c.proto
4328
4329// Begin of protos/perfetto/trace/ftrace/ion.proto
4330
4331message IonStatFtraceEvent {
4332  optional uint32 buffer_id = 1;
4333  optional int64 len = 2;
4334  optional uint64 total_allocated = 3;
4335}
4336
4337// End of protos/perfetto/trace/ftrace/ion.proto
4338
4339// Begin of protos/perfetto/trace/ftrace/ipi.proto
4340
4341message IpiEntryFtraceEvent {
4342  optional string reason = 1;
4343}
4344message IpiExitFtraceEvent {
4345  optional string reason = 1;
4346}
4347message IpiRaiseFtraceEvent {
4348  optional uint32 target_cpus = 1;
4349  optional string reason = 2;
4350}
4351
4352// End of protos/perfetto/trace/ftrace/ipi.proto
4353
4354// Begin of protos/perfetto/trace/ftrace/irq.proto
4355
4356message SoftirqEntryFtraceEvent {
4357  optional uint32 vec = 1;
4358}
4359message SoftirqExitFtraceEvent {
4360  optional uint32 vec = 1;
4361}
4362message SoftirqRaiseFtraceEvent {
4363  optional uint32 vec = 1;
4364}
4365message IrqHandlerEntryFtraceEvent {
4366  optional int32 irq = 1;
4367  optional string name = 2;
4368  optional uint32 handler = 3;
4369}
4370message IrqHandlerExitFtraceEvent {
4371  optional int32 irq = 1;
4372  optional int32 ret = 2;
4373}
4374
4375// End of protos/perfetto/trace/ftrace/irq.proto
4376
4377// Begin of protos/perfetto/trace/ftrace/kmem.proto
4378
4379message AllocPagesIommuEndFtraceEvent {
4380  optional uint32 gfp_flags = 1;
4381  optional uint32 order = 2;
4382}
4383message AllocPagesIommuFailFtraceEvent {
4384  optional uint32 gfp_flags = 1;
4385  optional uint32 order = 2;
4386}
4387message AllocPagesIommuStartFtraceEvent {
4388  optional uint32 gfp_flags = 1;
4389  optional uint32 order = 2;
4390}
4391message AllocPagesSysEndFtraceEvent {
4392  optional uint32 gfp_flags = 1;
4393  optional uint32 order = 2;
4394}
4395message AllocPagesSysFailFtraceEvent {
4396  optional uint32 gfp_flags = 1;
4397  optional uint32 order = 2;
4398}
4399message AllocPagesSysStartFtraceEvent {
4400  optional uint32 gfp_flags = 1;
4401  optional uint32 order = 2;
4402}
4403message DmaAllocContiguousRetryFtraceEvent {
4404  optional int32 tries = 1;
4405}
4406message IommuMapRangeFtraceEvent {
4407  optional uint64 chunk_size = 1;
4408  optional uint64 len = 2;
4409  optional uint64 pa = 3;
4410  optional uint64 va = 4;
4411}
4412message IommuSecPtblMapRangeEndFtraceEvent {
4413  optional uint64 len = 1;
4414  optional int32 num = 2;
4415  optional uint32 pa = 3;
4416  optional int32 sec_id = 4;
4417  optional uint64 va = 5;
4418}
4419message IommuSecPtblMapRangeStartFtraceEvent {
4420  optional uint64 len = 1;
4421  optional int32 num = 2;
4422  optional uint32 pa = 3;
4423  optional int32 sec_id = 4;
4424  optional uint64 va = 5;
4425}
4426message IonAllocBufferEndFtraceEvent {
4427  optional string client_name = 1;
4428  optional uint32 flags = 2;
4429  optional string heap_name = 3;
4430  optional uint64 len = 4;
4431  optional uint32 mask = 5;
4432}
4433message IonAllocBufferFailFtraceEvent {
4434  optional string client_name = 1;
4435  optional int64 error = 2;
4436  optional uint32 flags = 3;
4437  optional string heap_name = 4;
4438  optional uint64 len = 5;
4439  optional uint32 mask = 6;
4440}
4441message IonAllocBufferFallbackFtraceEvent {
4442  optional string client_name = 1;
4443  optional int64 error = 2;
4444  optional uint32 flags = 3;
4445  optional string heap_name = 4;
4446  optional uint64 len = 5;
4447  optional uint32 mask = 6;
4448}
4449message IonAllocBufferStartFtraceEvent {
4450  optional string client_name = 1;
4451  optional uint32 flags = 2;
4452  optional string heap_name = 3;
4453  optional uint64 len = 4;
4454  optional uint32 mask = 5;
4455}
4456message IonCpAllocRetryFtraceEvent {
4457  optional int32 tries = 1;
4458}
4459message IonCpSecureBufferEndFtraceEvent {
4460  optional uint64 align = 1;
4461  optional uint64 flags = 2;
4462  optional string heap_name = 3;
4463  optional uint64 len = 4;
4464}
4465message IonCpSecureBufferStartFtraceEvent {
4466  optional uint64 align = 1;
4467  optional uint64 flags = 2;
4468  optional string heap_name = 3;
4469  optional uint64 len = 4;
4470}
4471message IonPrefetchingFtraceEvent {
4472  optional uint64 len = 1;
4473}
4474message IonSecureCmaAddToPoolEndFtraceEvent {
4475  optional uint32 is_prefetch = 1;
4476  optional uint64 len = 2;
4477  optional int32 pool_total = 3;
4478}
4479message IonSecureCmaAddToPoolStartFtraceEvent {
4480  optional uint32 is_prefetch = 1;
4481  optional uint64 len = 2;
4482  optional int32 pool_total = 3;
4483}
4484message IonSecureCmaAllocateEndFtraceEvent {
4485  optional uint64 align = 1;
4486  optional uint64 flags = 2;
4487  optional string heap_name = 3;
4488  optional uint64 len = 4;
4489}
4490message IonSecureCmaAllocateStartFtraceEvent {
4491  optional uint64 align = 1;
4492  optional uint64 flags = 2;
4493  optional string heap_name = 3;
4494  optional uint64 len = 4;
4495}
4496message IonSecureCmaShrinkPoolEndFtraceEvent {
4497  optional uint64 drained_size = 1;
4498  optional uint64 skipped_size = 2;
4499}
4500message IonSecureCmaShrinkPoolStartFtraceEvent {
4501  optional uint64 drained_size = 1;
4502  optional uint64 skipped_size = 2;
4503}
4504message KfreeFtraceEvent {
4505  optional uint64 call_site = 1;
4506  optional uint64 ptr = 2;
4507}
4508message KmallocFtraceEvent {
4509  optional uint64 bytes_alloc = 1;
4510  optional uint64 bytes_req = 2;
4511  optional uint64 call_site = 3;
4512  optional uint32 gfp_flags = 4;
4513  optional uint64 ptr = 5;
4514}
4515message KmallocNodeFtraceEvent {
4516  optional uint64 bytes_alloc = 1;
4517  optional uint64 bytes_req = 2;
4518  optional uint64 call_site = 3;
4519  optional uint32 gfp_flags = 4;
4520  optional int32 node = 5;
4521  optional uint64 ptr = 6;
4522}
4523message KmemCacheAllocFtraceEvent {
4524  optional uint64 bytes_alloc = 1;
4525  optional uint64 bytes_req = 2;
4526  optional uint64 call_site = 3;
4527  optional uint32 gfp_flags = 4;
4528  optional uint64 ptr = 5;
4529}
4530message KmemCacheAllocNodeFtraceEvent {
4531  optional uint64 bytes_alloc = 1;
4532  optional uint64 bytes_req = 2;
4533  optional uint64 call_site = 3;
4534  optional uint32 gfp_flags = 4;
4535  optional int32 node = 5;
4536  optional uint64 ptr = 6;
4537}
4538message KmemCacheFreeFtraceEvent {
4539  optional uint64 call_site = 1;
4540  optional uint64 ptr = 2;
4541}
4542message MigratePagesEndFtraceEvent {
4543  optional int32 mode = 1;
4544}
4545message MigratePagesStartFtraceEvent {
4546  optional int32 mode = 1;
4547}
4548message MigrateRetryFtraceEvent {
4549  optional int32 tries = 1;
4550}
4551message MmPageAllocFtraceEvent {
4552  optional uint32 gfp_flags = 1;
4553  optional int32 migratetype = 2;
4554  optional uint32 order = 3;
4555  optional uint64 page = 4;
4556  optional uint64 pfn = 5;
4557}
4558message MmPageAllocExtfragFtraceEvent {
4559  optional int32 alloc_migratetype = 1;
4560  optional int32 alloc_order = 2;
4561  optional int32 fallback_migratetype = 3;
4562  optional int32 fallback_order = 4;
4563  optional uint64 page = 5;
4564  optional int32 change_ownership = 6;
4565  optional uint64 pfn = 7;
4566}
4567message MmPageAllocZoneLockedFtraceEvent {
4568  optional int32 migratetype = 1;
4569  optional uint32 order = 2;
4570  optional uint64 page = 3;
4571  optional uint64 pfn = 4;
4572}
4573message MmPageFreeFtraceEvent {
4574  optional uint32 order = 1;
4575  optional uint64 page = 2;
4576  optional uint64 pfn = 3;
4577}
4578message MmPageFreeBatchedFtraceEvent {
4579  optional int32 cold = 1;
4580  optional uint64 page = 2;
4581  optional uint64 pfn = 3;
4582}
4583message MmPagePcpuDrainFtraceEvent {
4584  optional int32 migratetype = 1;
4585  optional uint32 order = 2;
4586  optional uint64 page = 3;
4587  optional uint64 pfn = 4;
4588}
4589message RssStatFtraceEvent {
4590  optional int32 member = 1;
4591  optional int64 size = 2;
4592  optional uint32 curr = 3;
4593  optional uint32 mm_id = 4;
4594}
4595message IonHeapShrinkFtraceEvent {
4596  optional string heap_name = 1;
4597  optional uint64 len = 2;
4598  optional int64 total_allocated = 3;
4599}
4600message IonHeapGrowFtraceEvent {
4601  optional string heap_name = 1;
4602  optional uint64 len = 2;
4603  optional int64 total_allocated = 3;
4604}
4605message IonBufferCreateFtraceEvent {
4606  optional uint64 addr = 1;
4607  optional uint64 len = 2;
4608}
4609message IonBufferDestroyFtraceEvent {
4610  optional uint64 addr = 1;
4611  optional uint64 len = 2;
4612}
4613
4614// End of protos/perfetto/trace/ftrace/kmem.proto
4615
4616// Begin of protos/perfetto/trace/ftrace/lowmemorykiller.proto
4617
4618message LowmemoryKillFtraceEvent {
4619  optional string comm = 1;
4620  optional int32 pid = 2;
4621  optional int64 pagecache_size = 3;
4622  optional int64 pagecache_limit = 4;
4623  optional int64 free = 5;
4624}
4625
4626// End of protos/perfetto/trace/ftrace/lowmemorykiller.proto
4627
4628// Begin of protos/perfetto/trace/ftrace/mali.proto
4629
4630message MaliTracingMarkWriteFtraceEvent {
4631  optional string name = 1;
4632  optional int32 pid = 2;
4633  optional uint32 type = 3;
4634  optional int32 value = 4;
4635}
4636
4637// End of protos/perfetto/trace/ftrace/mali.proto
4638
4639// Begin of protos/perfetto/trace/ftrace/mdss.proto
4640
4641message MdpCmdKickoffFtraceEvent {
4642  optional uint32 ctl_num = 1;
4643  optional int32 kickoff_cnt = 2;
4644}
4645message MdpCommitFtraceEvent {
4646  optional uint32 num = 1;
4647  optional uint32 play_cnt = 2;
4648  optional uint32 clk_rate = 3;
4649  optional uint64 bandwidth = 4;
4650}
4651message MdpPerfSetOtFtraceEvent {
4652  optional uint32 pnum = 1;
4653  optional uint32 xin_id = 2;
4654  optional uint32 rd_lim = 3;
4655  optional uint32 is_vbif_rt = 4;
4656}
4657message MdpSsppChangeFtraceEvent {
4658  optional uint32 num = 1;
4659  optional uint32 play_cnt = 2;
4660  optional uint32 mixer = 3;
4661  optional uint32 stage = 4;
4662  optional uint32 flags = 5;
4663  optional uint32 format = 6;
4664  optional uint32 img_w = 7;
4665  optional uint32 img_h = 8;
4666  optional uint32 src_x = 9;
4667  optional uint32 src_y = 10;
4668  optional uint32 src_w = 11;
4669  optional uint32 src_h = 12;
4670  optional uint32 dst_x = 13;
4671  optional uint32 dst_y = 14;
4672  optional uint32 dst_w = 15;
4673  optional uint32 dst_h = 16;
4674}
4675message TracingMarkWriteFtraceEvent {
4676  optional int32 pid = 1;
4677  optional string trace_name = 2;
4678  optional uint32 trace_begin = 3;
4679}
4680message MdpCmdPingpongDoneFtraceEvent {
4681  optional uint32 ctl_num = 1;
4682  optional uint32 intf_num = 2;
4683  optional uint32 pp_num = 3;
4684  optional int32 koff_cnt = 4;
4685}
4686message MdpCompareBwFtraceEvent {
4687  optional uint64 new_ab = 1;
4688  optional uint64 new_ib = 2;
4689  optional uint64 new_wb = 3;
4690  optional uint64 old_ab = 4;
4691  optional uint64 old_ib = 5;
4692  optional uint64 old_wb = 6;
4693  optional uint32 params_changed = 7;
4694  optional uint32 update_bw = 8;
4695}
4696message MdpPerfSetPanicLutsFtraceEvent {
4697  optional uint32 pnum = 1;
4698  optional uint32 fmt = 2;
4699  optional uint32 mode = 3;
4700  optional uint32 panic_lut = 4;
4701  optional uint32 robust_lut = 5;
4702}
4703message MdpSsppSetFtraceEvent {
4704  optional uint32 num = 1;
4705  optional uint32 play_cnt = 2;
4706  optional uint32 mixer = 3;
4707  optional uint32 stage = 4;
4708  optional uint32 flags = 5;
4709  optional uint32 format = 6;
4710  optional uint32 img_w = 7;
4711  optional uint32 img_h = 8;
4712  optional uint32 src_x = 9;
4713  optional uint32 src_y = 10;
4714  optional uint32 src_w = 11;
4715  optional uint32 src_h = 12;
4716  optional uint32 dst_x = 13;
4717  optional uint32 dst_y = 14;
4718  optional uint32 dst_w = 15;
4719  optional uint32 dst_h = 16;
4720}
4721message MdpCmdReadptrDoneFtraceEvent {
4722  optional uint32 ctl_num = 1;
4723  optional int32 koff_cnt = 2;
4724}
4725message MdpMisrCrcFtraceEvent {
4726  optional uint32 block_id = 1;
4727  optional uint32 vsync_cnt = 2;
4728  optional uint32 crc = 3;
4729}
4730message MdpPerfSetQosLutsFtraceEvent {
4731  optional uint32 pnum = 1;
4732  optional uint32 fmt = 2;
4733  optional uint32 intf = 3;
4734  optional uint32 rot = 4;
4735  optional uint32 fl = 5;
4736  optional uint32 lut = 6;
4737  optional uint32 linear = 7;
4738}
4739message MdpTraceCounterFtraceEvent {
4740  optional int32 pid = 1;
4741  optional string counter_name = 2;
4742  optional int32 value = 3;
4743}
4744message MdpCmdReleaseBwFtraceEvent {
4745  optional uint32 ctl_num = 1;
4746}
4747message MdpMixerUpdateFtraceEvent {
4748  optional uint32 mixer_num = 1;
4749}
4750message MdpPerfSetWmLevelsFtraceEvent {
4751  optional uint32 pnum = 1;
4752  optional uint32 use_space = 2;
4753  optional uint32 priority_bytes = 3;
4754  optional uint32 wm0 = 4;
4755  optional uint32 wm1 = 5;
4756  optional uint32 wm2 = 6;
4757  optional uint32 mb_cnt = 7;
4758  optional uint32 mb_size = 8;
4759}
4760message MdpVideoUnderrunDoneFtraceEvent {
4761  optional uint32 ctl_num = 1;
4762  optional uint32 underrun_cnt = 2;
4763}
4764message MdpCmdWaitPingpongFtraceEvent {
4765  optional uint32 ctl_num = 1;
4766  optional int32 kickoff_cnt = 2;
4767}
4768message MdpPerfPrefillCalcFtraceEvent {
4769  optional uint32 pnum = 1;
4770  optional uint32 latency_buf = 2;
4771  optional uint32 ot = 3;
4772  optional uint32 y_buf = 4;
4773  optional uint32 y_scaler = 5;
4774  optional uint32 pp_lines = 6;
4775  optional uint32 pp_bytes = 7;
4776  optional uint32 post_sc = 8;
4777  optional uint32 fbc_bytes = 9;
4778  optional uint32 prefill_bytes = 10;
4779}
4780message MdpPerfUpdateBusFtraceEvent {
4781  optional int32 client = 1;
4782  optional uint64 ab_quota = 2;
4783  optional uint64 ib_quota = 3;
4784}
4785message RotatorBwAoAsContextFtraceEvent {
4786  optional uint32 state = 1;
4787}
4788
4789// End of protos/perfetto/trace/ftrace/mdss.proto
4790
4791// Begin of protos/perfetto/trace/ftrace/mm_event.proto
4792
4793message MmEventRecordFtraceEvent {
4794  optional uint32 avg_lat = 1;
4795  optional uint32 count = 2;
4796  optional uint32 max_lat = 3;
4797  optional uint32 type = 4;
4798}
4799
4800// End of protos/perfetto/trace/ftrace/mm_event.proto
4801
4802// Begin of protos/perfetto/trace/ftrace/oom.proto
4803
4804message OomScoreAdjUpdateFtraceEvent {
4805  optional string comm = 1;
4806  optional int32 oom_score_adj = 2;
4807  optional int32 pid = 3;
4808}
4809message MarkVictimFtraceEvent {
4810  optional int32 pid = 1;
4811}
4812
4813// End of protos/perfetto/trace/ftrace/oom.proto
4814
4815// Begin of protos/perfetto/trace/ftrace/power.proto
4816
4817message CpuFrequencyFtraceEvent {
4818  optional uint32 state = 1;
4819  optional uint32 cpu_id = 2;
4820}
4821message CpuFrequencyLimitsFtraceEvent {
4822  optional uint32 min_freq = 1;
4823  optional uint32 max_freq = 2;
4824  optional uint32 cpu_id = 3;
4825}
4826message CpuIdleFtraceEvent {
4827  optional uint32 state = 1;
4828  optional uint32 cpu_id = 2;
4829}
4830message ClockEnableFtraceEvent {
4831  optional string name = 1;
4832  optional uint64 state = 2;
4833  optional uint64 cpu_id = 3;
4834}
4835message ClockDisableFtraceEvent {
4836  optional string name = 1;
4837  optional uint64 state = 2;
4838  optional uint64 cpu_id = 3;
4839}
4840message ClockSetRateFtraceEvent {
4841  optional string name = 1;
4842  optional uint64 state = 2;
4843  optional uint64 cpu_id = 3;
4844}
4845message SuspendResumeFtraceEvent {
4846  optional string action = 1;
4847  optional int32 val = 2;
4848  optional uint32 start = 3;
4849}
4850message GpuFrequencyFtraceEvent {
4851  optional uint32 gpu_id = 1;
4852  optional uint32 state = 2;
4853}
4854
4855// End of protos/perfetto/trace/ftrace/power.proto
4856
4857// Begin of protos/perfetto/trace/ftrace/raw_syscalls.proto
4858
4859message SysEnterFtraceEvent {
4860  optional int64 id = 1;
4861}
4862message SysExitFtraceEvent {
4863  optional int64 id = 1;
4864  optional int64 ret = 2;
4865}
4866
4867// End of protos/perfetto/trace/ftrace/raw_syscalls.proto
4868
4869// Begin of protos/perfetto/trace/ftrace/regulator.proto
4870
4871message RegulatorDisableFtraceEvent {
4872  optional string name = 1;
4873}
4874message RegulatorDisableCompleteFtraceEvent {
4875  optional string name = 1;
4876}
4877message RegulatorEnableFtraceEvent {
4878  optional string name = 1;
4879}
4880message RegulatorEnableCompleteFtraceEvent {
4881  optional string name = 1;
4882}
4883message RegulatorEnableDelayFtraceEvent {
4884  optional string name = 1;
4885}
4886message RegulatorSetVoltageFtraceEvent {
4887  optional string name = 1;
4888  optional int32 min = 2;
4889  optional int32 max = 3;
4890}
4891message RegulatorSetVoltageCompleteFtraceEvent {
4892  optional string name = 1;
4893  optional uint32 val = 2;
4894}
4895
4896// End of protos/perfetto/trace/ftrace/regulator.proto
4897
4898// Begin of protos/perfetto/trace/ftrace/sched.proto
4899
4900message SchedSwitchFtraceEvent {
4901  optional string prev_comm = 1;
4902  optional int32 prev_pid = 2;
4903  optional int32 prev_prio = 3;
4904  optional int64 prev_state = 4;
4905  optional string next_comm = 5;
4906  optional int32 next_pid = 6;
4907  optional int32 next_prio = 7;
4908}
4909message SchedWakeupFtraceEvent {
4910  optional string comm = 1;
4911  optional int32 pid = 2;
4912  optional int32 prio = 3;
4913  optional int32 success = 4;
4914  optional int32 target_cpu = 5;
4915}
4916message SchedBlockedReasonFtraceEvent {
4917  optional int32 pid = 1;
4918  optional uint64 caller = 2;
4919  optional uint32 io_wait = 3;
4920}
4921message SchedCpuHotplugFtraceEvent {
4922  optional int32 affected_cpu = 1;
4923  optional int32 error = 2;
4924  optional int32 status = 3;
4925}
4926message SchedWakingFtraceEvent {
4927  optional string comm = 1;
4928  optional int32 pid = 2;
4929  optional int32 prio = 3;
4930  optional int32 success = 4;
4931  optional int32 target_cpu = 5;
4932}
4933message SchedWakeupNewFtraceEvent {
4934  optional string comm = 1;
4935  optional int32 pid = 2;
4936  optional int32 prio = 3;
4937  optional int32 success = 4;
4938  optional int32 target_cpu = 5;
4939}
4940message SchedProcessExecFtraceEvent {
4941  optional string filename = 1;
4942  optional int32 pid = 2;
4943  optional int32 old_pid = 3;
4944}
4945message SchedProcessExitFtraceEvent {
4946  optional string comm = 1;
4947  optional int32 pid = 2;
4948  optional int32 tgid = 3;
4949  optional int32 prio = 4;
4950}
4951message SchedProcessForkFtraceEvent {
4952  optional string parent_comm = 1;
4953  optional int32 parent_pid = 2;
4954  optional string child_comm = 3;
4955  optional int32 child_pid = 4;
4956}
4957message SchedProcessFreeFtraceEvent {
4958  optional string comm = 1;
4959  optional int32 pid = 2;
4960  optional int32 prio = 3;
4961}
4962message SchedProcessHangFtraceEvent {
4963  optional string comm = 1;
4964  optional int32 pid = 2;
4965}
4966message SchedProcessWaitFtraceEvent {
4967  optional string comm = 1;
4968  optional int32 pid = 2;
4969  optional int32 prio = 3;
4970}
4971message SchedPiSetprioFtraceEvent {
4972  optional string comm = 1;
4973  optional int32 newprio = 2;
4974  optional int32 oldprio = 3;
4975  optional int32 pid = 4;
4976}
4977
4978// End of protos/perfetto/trace/ftrace/sched.proto
4979
4980// Begin of protos/perfetto/trace/ftrace/scm.proto
4981
4982message ScmCallStartFtraceEvent {
4983  optional uint32 arginfo = 1;
4984  optional uint64 x0 = 2;
4985  optional uint64 x5 = 3;
4986}
4987message ScmCallEndFtraceEvent {}
4988
4989// End of protos/perfetto/trace/ftrace/scm.proto
4990
4991// Begin of protos/perfetto/trace/ftrace/sde.proto
4992
4993message SdeTracingMarkWriteFtraceEvent {
4994  optional int32 pid = 1;
4995  optional string trace_name = 2;
4996  optional uint32 trace_type = 3;
4997  optional int32 value = 4;
4998  optional uint32 trace_begin = 5;
4999}
5000message SdeSdeEvtlogFtraceEvent {
5001  optional string evtlog_tag = 1;
5002  optional int32 pid = 2;
5003  optional uint32 tag_id = 3;
5004}
5005message SdeSdePerfCalcCrtcFtraceEvent {
5006  optional uint64 bw_ctl_ebi = 1;
5007  optional uint64 bw_ctl_llcc = 2;
5008  optional uint64 bw_ctl_mnoc = 3;
5009  optional uint32 core_clk_rate = 4;
5010  optional uint32 crtc = 5;
5011  optional uint64 ib_ebi = 6;
5012  optional uint64 ib_llcc = 7;
5013  optional uint64 ib_mnoc = 8;
5014}
5015message SdeSdePerfCrtcUpdateFtraceEvent {
5016  optional uint64 bw_ctl_ebi = 1;
5017  optional uint64 bw_ctl_llcc = 2;
5018  optional uint64 bw_ctl_mnoc = 3;
5019  optional uint32 core_clk_rate = 4;
5020  optional uint32 crtc = 5;
5021  optional int32 params = 6;
5022  optional uint64 per_pipe_ib_ebi = 7;
5023  optional uint64 per_pipe_ib_llcc = 8;
5024  optional uint64 per_pipe_ib_mnoc = 9;
5025  optional uint32 stop_req = 10;
5026  optional uint32 update_bus = 11;
5027  optional uint32 update_clk = 12;
5028}
5029message SdeSdePerfSetQosLutsFtraceEvent {
5030  optional uint32 fl = 1;
5031  optional uint32 fmt = 2;
5032  optional uint64 lut = 3;
5033  optional uint32 lut_usage = 4;
5034  optional uint32 pnum = 5;
5035  optional uint32 rt = 6;
5036}
5037message SdeSdePerfUpdateBusFtraceEvent {
5038  optional uint64 ab_quota = 1;
5039  optional uint32 bus_id = 2;
5040  optional int32 client = 3;
5041  optional uint64 ib_quota = 4;
5042}
5043
5044// End of protos/perfetto/trace/ftrace/sde.proto
5045
5046// Begin of protos/perfetto/trace/ftrace/signal.proto
5047
5048message SignalDeliverFtraceEvent {
5049  optional int32 code = 1;
5050  optional uint64 sa_flags = 2;
5051  optional int32 sig = 3;
5052}
5053message SignalGenerateFtraceEvent {
5054  optional int32 code = 1;
5055  optional string comm = 2;
5056  optional int32 group = 3;
5057  optional int32 pid = 4;
5058  optional int32 result = 5;
5059  optional int32 sig = 6;
5060}
5061
5062// End of protos/perfetto/trace/ftrace/signal.proto
5063
5064// Begin of protos/perfetto/trace/ftrace/sync.proto
5065
5066message SyncPtFtraceEvent {
5067  optional string timeline = 1;
5068  optional string value = 2;
5069}
5070message SyncTimelineFtraceEvent {
5071  optional string name = 1;
5072  optional string value = 2;
5073}
5074message SyncWaitFtraceEvent {
5075  optional string name = 1;
5076  optional int32 status = 2;
5077  optional uint32 begin = 3;
5078}
5079
5080// End of protos/perfetto/trace/ftrace/sync.proto
5081
5082// Begin of protos/perfetto/trace/ftrace/systrace.proto
5083
5084message ZeroFtraceEvent {
5085  optional int32 flag = 1;
5086  optional string name = 2;
5087  optional int32 pid = 3;
5088  optional int64 value = 4;
5089}
5090
5091// End of protos/perfetto/trace/ftrace/systrace.proto
5092
5093// Begin of protos/perfetto/trace/ftrace/task.proto
5094
5095message TaskNewtaskFtraceEvent {
5096  optional int32 pid = 1;
5097  optional string comm = 2;
5098  optional uint64 clone_flags = 3;
5099  optional int32 oom_score_adj = 4;
5100}
5101message TaskRenameFtraceEvent {
5102  optional int32 pid = 1;
5103  optional string oldcomm = 2;
5104  optional string newcomm = 3;
5105  optional int32 oom_score_adj = 4;
5106}
5107
5108// End of protos/perfetto/trace/ftrace/task.proto
5109
5110// Begin of protos/perfetto/trace/ftrace/thermal.proto
5111
5112message ThermalTemperatureFtraceEvent {
5113  optional int32 id = 1;
5114  optional int32 temp = 2;
5115  optional int32 temp_prev = 3;
5116  optional string thermal_zone = 4;
5117}
5118message CdevUpdateFtraceEvent {
5119  optional uint64 target = 1;
5120  optional string type = 2;
5121}
5122
5123// End of protos/perfetto/trace/ftrace/thermal.proto
5124
5125// Begin of protos/perfetto/trace/ftrace/vmscan.proto
5126
5127message MmVmscanDirectReclaimBeginFtraceEvent {
5128  optional int32 order = 1;
5129  optional int32 may_writepage = 2;
5130  optional uint32 gfp_flags = 3;
5131}
5132message MmVmscanDirectReclaimEndFtraceEvent {
5133  optional uint64 nr_reclaimed = 1;
5134}
5135message MmVmscanKswapdWakeFtraceEvent {
5136  optional int32 nid = 1;
5137  optional int32 order = 2;
5138}
5139message MmVmscanKswapdSleepFtraceEvent {
5140  optional int32 nid = 1;
5141}
5142
5143// End of protos/perfetto/trace/ftrace/vmscan.proto
5144
5145// Begin of protos/perfetto/trace/ftrace/workqueue.proto
5146
5147message WorkqueueActivateWorkFtraceEvent {
5148  optional uint64 work = 1;
5149}
5150message WorkqueueExecuteEndFtraceEvent {
5151  optional uint64 work = 1;
5152}
5153message WorkqueueExecuteStartFtraceEvent {
5154  optional uint64 work = 1;
5155  optional uint64 function = 2;
5156}
5157message WorkqueueQueueWorkFtraceEvent {
5158  optional uint64 work = 1;
5159  optional uint64 function = 2;
5160  optional uint64 workqueue = 3;
5161  optional uint32 req_cpu = 4;
5162  optional uint32 cpu = 5;
5163}
5164
5165// End of protos/perfetto/trace/ftrace/workqueue.proto
5166
5167// Begin of protos/perfetto/trace/ftrace/ftrace_event.proto
5168
5169message FtraceEvent {
5170  // Nanoseconds since an epoch.
5171  // Epoch is configurable by writing into trace_clock.
5172  // By default this timestamp is CPU local.
5173  // TODO: Figure out a story for reconciling the various clocks.
5174  optional uint64 timestamp = 1;
5175
5176  // Kernel pid (do not confuse with userspace pid aka tgid)
5177  optional uint32 pid = 2;
5178
5179  oneof event {
5180    PrintFtraceEvent print = 3;
5181    SchedSwitchFtraceEvent sched_switch = 4;
5182    // removed field with id 5;
5183    // removed field with id 6;
5184    // removed field with id 7;
5185    // removed field with id 8;
5186    // removed field with id 9;
5187    // removed field with id 10;
5188    CpuFrequencyFtraceEvent cpu_frequency = 11;
5189    CpuFrequencyLimitsFtraceEvent cpu_frequency_limits = 12;
5190    CpuIdleFtraceEvent cpu_idle = 13;
5191    ClockEnableFtraceEvent clock_enable = 14;
5192    ClockDisableFtraceEvent clock_disable = 15;
5193    ClockSetRateFtraceEvent clock_set_rate = 16;
5194    SchedWakeupFtraceEvent sched_wakeup = 17;
5195    SchedBlockedReasonFtraceEvent sched_blocked_reason = 18;
5196    SchedCpuHotplugFtraceEvent sched_cpu_hotplug = 19;
5197    SchedWakingFtraceEvent sched_waking = 20;
5198    IpiEntryFtraceEvent ipi_entry = 21;
5199    IpiExitFtraceEvent ipi_exit = 22;
5200    IpiRaiseFtraceEvent ipi_raise = 23;
5201    SoftirqEntryFtraceEvent softirq_entry = 24;
5202    SoftirqExitFtraceEvent softirq_exit = 25;
5203    SoftirqRaiseFtraceEvent softirq_raise = 26;
5204    I2cReadFtraceEvent i2c_read = 27;
5205    I2cWriteFtraceEvent i2c_write = 28;
5206    I2cResultFtraceEvent i2c_result = 29;
5207    I2cReplyFtraceEvent i2c_reply = 30;
5208    SmbusReadFtraceEvent smbus_read = 31;
5209    SmbusWriteFtraceEvent smbus_write = 32;
5210    SmbusResultFtraceEvent smbus_result = 33;
5211    SmbusReplyFtraceEvent smbus_reply = 34;
5212    LowmemoryKillFtraceEvent lowmemory_kill = 35;
5213    IrqHandlerEntryFtraceEvent irq_handler_entry = 36;
5214    IrqHandlerExitFtraceEvent irq_handler_exit = 37;
5215    SyncPtFtraceEvent sync_pt = 38;
5216    SyncTimelineFtraceEvent sync_timeline = 39;
5217    SyncWaitFtraceEvent sync_wait = 40;
5218    Ext4DaWriteBeginFtraceEvent ext4_da_write_begin = 41;
5219    Ext4DaWriteEndFtraceEvent ext4_da_write_end = 42;
5220    Ext4SyncFileEnterFtraceEvent ext4_sync_file_enter = 43;
5221    Ext4SyncFileExitFtraceEvent ext4_sync_file_exit = 44;
5222    BlockRqIssueFtraceEvent block_rq_issue = 45;
5223    MmVmscanDirectReclaimBeginFtraceEvent mm_vmscan_direct_reclaim_begin = 46;
5224    MmVmscanDirectReclaimEndFtraceEvent mm_vmscan_direct_reclaim_end = 47;
5225    MmVmscanKswapdWakeFtraceEvent mm_vmscan_kswapd_wake = 48;
5226    MmVmscanKswapdSleepFtraceEvent mm_vmscan_kswapd_sleep = 49;
5227    BinderTransactionFtraceEvent binder_transaction = 50;
5228    BinderTransactionReceivedFtraceEvent binder_transaction_received = 51;
5229    BinderSetPriorityFtraceEvent binder_set_priority = 52;
5230    BinderLockFtraceEvent binder_lock = 53;
5231    BinderLockedFtraceEvent binder_locked = 54;
5232    BinderUnlockFtraceEvent binder_unlock = 55;
5233    WorkqueueActivateWorkFtraceEvent workqueue_activate_work = 56;
5234    WorkqueueExecuteEndFtraceEvent workqueue_execute_end = 57;
5235    WorkqueueExecuteStartFtraceEvent workqueue_execute_start = 58;
5236    WorkqueueQueueWorkFtraceEvent workqueue_queue_work = 59;
5237    RegulatorDisableFtraceEvent regulator_disable = 60;
5238    RegulatorDisableCompleteFtraceEvent regulator_disable_complete = 61;
5239    RegulatorEnableFtraceEvent regulator_enable = 62;
5240    RegulatorEnableCompleteFtraceEvent regulator_enable_complete = 63;
5241    RegulatorEnableDelayFtraceEvent regulator_enable_delay = 64;
5242    RegulatorSetVoltageFtraceEvent regulator_set_voltage = 65;
5243    RegulatorSetVoltageCompleteFtraceEvent regulator_set_voltage_complete = 66;
5244    CgroupAttachTaskFtraceEvent cgroup_attach_task = 67;
5245    CgroupMkdirFtraceEvent cgroup_mkdir = 68;
5246    CgroupRemountFtraceEvent cgroup_remount = 69;
5247    CgroupRmdirFtraceEvent cgroup_rmdir = 70;
5248    CgroupTransferTasksFtraceEvent cgroup_transfer_tasks = 71;
5249    CgroupDestroyRootFtraceEvent cgroup_destroy_root = 72;
5250    CgroupReleaseFtraceEvent cgroup_release = 73;
5251    CgroupRenameFtraceEvent cgroup_rename = 74;
5252    CgroupSetupRootFtraceEvent cgroup_setup_root = 75;
5253    MdpCmdKickoffFtraceEvent mdp_cmd_kickoff = 76;
5254    MdpCommitFtraceEvent mdp_commit = 77;
5255    MdpPerfSetOtFtraceEvent mdp_perf_set_ot = 78;
5256    MdpSsppChangeFtraceEvent mdp_sspp_change = 79;
5257    TracingMarkWriteFtraceEvent tracing_mark_write = 80;
5258    MdpCmdPingpongDoneFtraceEvent mdp_cmd_pingpong_done = 81;
5259    MdpCompareBwFtraceEvent mdp_compare_bw = 82;
5260    MdpPerfSetPanicLutsFtraceEvent mdp_perf_set_panic_luts = 83;
5261    MdpSsppSetFtraceEvent mdp_sspp_set = 84;
5262    MdpCmdReadptrDoneFtraceEvent mdp_cmd_readptr_done = 85;
5263    MdpMisrCrcFtraceEvent mdp_misr_crc = 86;
5264    MdpPerfSetQosLutsFtraceEvent mdp_perf_set_qos_luts = 87;
5265    MdpTraceCounterFtraceEvent mdp_trace_counter = 88;
5266    MdpCmdReleaseBwFtraceEvent mdp_cmd_release_bw = 89;
5267    MdpMixerUpdateFtraceEvent mdp_mixer_update = 90;
5268    MdpPerfSetWmLevelsFtraceEvent mdp_perf_set_wm_levels = 91;
5269    MdpVideoUnderrunDoneFtraceEvent mdp_video_underrun_done = 92;
5270    MdpCmdWaitPingpongFtraceEvent mdp_cmd_wait_pingpong = 93;
5271    MdpPerfPrefillCalcFtraceEvent mdp_perf_prefill_calc = 94;
5272    MdpPerfUpdateBusFtraceEvent mdp_perf_update_bus = 95;
5273    RotatorBwAoAsContextFtraceEvent rotator_bw_ao_as_context = 96;
5274    MmFilemapAddToPageCacheFtraceEvent mm_filemap_add_to_page_cache = 97;
5275    MmFilemapDeleteFromPageCacheFtraceEvent mm_filemap_delete_from_page_cache =
5276        98;
5277    MmCompactionBeginFtraceEvent mm_compaction_begin = 99;
5278    MmCompactionDeferCompactionFtraceEvent mm_compaction_defer_compaction = 100;
5279    MmCompactionDeferredFtraceEvent mm_compaction_deferred = 101;
5280    MmCompactionDeferResetFtraceEvent mm_compaction_defer_reset = 102;
5281    MmCompactionEndFtraceEvent mm_compaction_end = 103;
5282    MmCompactionFinishedFtraceEvent mm_compaction_finished = 104;
5283    MmCompactionIsolateFreepagesFtraceEvent mm_compaction_isolate_freepages =
5284        105;
5285    MmCompactionIsolateMigratepagesFtraceEvent
5286        mm_compaction_isolate_migratepages = 106;
5287    MmCompactionKcompactdSleepFtraceEvent mm_compaction_kcompactd_sleep = 107;
5288    MmCompactionKcompactdWakeFtraceEvent mm_compaction_kcompactd_wake = 108;
5289    MmCompactionMigratepagesFtraceEvent mm_compaction_migratepages = 109;
5290    MmCompactionSuitableFtraceEvent mm_compaction_suitable = 110;
5291    MmCompactionTryToCompactPagesFtraceEvent
5292        mm_compaction_try_to_compact_pages = 111;
5293    MmCompactionWakeupKcompactdFtraceEvent mm_compaction_wakeup_kcompactd = 112;
5294    SuspendResumeFtraceEvent suspend_resume = 113;
5295    SchedWakeupNewFtraceEvent sched_wakeup_new = 114;
5296    BlockBioBackmergeFtraceEvent block_bio_backmerge = 115;
5297    BlockBioBounceFtraceEvent block_bio_bounce = 116;
5298    BlockBioCompleteFtraceEvent block_bio_complete = 117;
5299    BlockBioFrontmergeFtraceEvent block_bio_frontmerge = 118;
5300    BlockBioQueueFtraceEvent block_bio_queue = 119;
5301    BlockBioRemapFtraceEvent block_bio_remap = 120;
5302    BlockDirtyBufferFtraceEvent block_dirty_buffer = 121;
5303    BlockGetrqFtraceEvent block_getrq = 122;
5304    BlockPlugFtraceEvent block_plug = 123;
5305    BlockRqAbortFtraceEvent block_rq_abort = 124;
5306    BlockRqCompleteFtraceEvent block_rq_complete = 125;
5307    BlockRqInsertFtraceEvent block_rq_insert = 126;
5308    // removed field with id 127;
5309    BlockRqRemapFtraceEvent block_rq_remap = 128;
5310    BlockRqRequeueFtraceEvent block_rq_requeue = 129;
5311    BlockSleeprqFtraceEvent block_sleeprq = 130;
5312    BlockSplitFtraceEvent block_split = 131;
5313    BlockTouchBufferFtraceEvent block_touch_buffer = 132;
5314    BlockUnplugFtraceEvent block_unplug = 133;
5315    Ext4AllocDaBlocksFtraceEvent ext4_alloc_da_blocks = 134;
5316    Ext4AllocateBlocksFtraceEvent ext4_allocate_blocks = 135;
5317    Ext4AllocateInodeFtraceEvent ext4_allocate_inode = 136;
5318    Ext4BeginOrderedTruncateFtraceEvent ext4_begin_ordered_truncate = 137;
5319    Ext4CollapseRangeFtraceEvent ext4_collapse_range = 138;
5320    Ext4DaReleaseSpaceFtraceEvent ext4_da_release_space = 139;
5321    Ext4DaReserveSpaceFtraceEvent ext4_da_reserve_space = 140;
5322    Ext4DaUpdateReserveSpaceFtraceEvent ext4_da_update_reserve_space = 141;
5323    Ext4DaWritePagesFtraceEvent ext4_da_write_pages = 142;
5324    Ext4DaWritePagesExtentFtraceEvent ext4_da_write_pages_extent = 143;
5325    Ext4DirectIOEnterFtraceEvent ext4_direct_IO_enter = 144;
5326    Ext4DirectIOExitFtraceEvent ext4_direct_IO_exit = 145;
5327    Ext4DiscardBlocksFtraceEvent ext4_discard_blocks = 146;
5328    Ext4DiscardPreallocationsFtraceEvent ext4_discard_preallocations = 147;
5329    Ext4DropInodeFtraceEvent ext4_drop_inode = 148;
5330    Ext4EsCacheExtentFtraceEvent ext4_es_cache_extent = 149;
5331    Ext4EsFindDelayedExtentRangeEnterFtraceEvent
5332        ext4_es_find_delayed_extent_range_enter = 150;
5333    Ext4EsFindDelayedExtentRangeExitFtraceEvent
5334        ext4_es_find_delayed_extent_range_exit = 151;
5335    Ext4EsInsertExtentFtraceEvent ext4_es_insert_extent = 152;
5336    Ext4EsLookupExtentEnterFtraceEvent ext4_es_lookup_extent_enter = 153;
5337    Ext4EsLookupExtentExitFtraceEvent ext4_es_lookup_extent_exit = 154;
5338    Ext4EsRemoveExtentFtraceEvent ext4_es_remove_extent = 155;
5339    Ext4EsShrinkFtraceEvent ext4_es_shrink = 156;
5340    Ext4EsShrinkCountFtraceEvent ext4_es_shrink_count = 157;
5341    Ext4EsShrinkScanEnterFtraceEvent ext4_es_shrink_scan_enter = 158;
5342    Ext4EsShrinkScanExitFtraceEvent ext4_es_shrink_scan_exit = 159;
5343    Ext4EvictInodeFtraceEvent ext4_evict_inode = 160;
5344    Ext4ExtConvertToInitializedEnterFtraceEvent
5345        ext4_ext_convert_to_initialized_enter = 161;
5346    Ext4ExtConvertToInitializedFastpathFtraceEvent
5347        ext4_ext_convert_to_initialized_fastpath = 162;
5348    Ext4ExtHandleUnwrittenExtentsFtraceEvent ext4_ext_handle_unwritten_extents =
5349        163;
5350    Ext4ExtInCacheFtraceEvent ext4_ext_in_cache = 164;
5351    Ext4ExtLoadExtentFtraceEvent ext4_ext_load_extent = 165;
5352    Ext4ExtMapBlocksEnterFtraceEvent ext4_ext_map_blocks_enter = 166;
5353    Ext4ExtMapBlocksExitFtraceEvent ext4_ext_map_blocks_exit = 167;
5354    Ext4ExtPutInCacheFtraceEvent ext4_ext_put_in_cache = 168;
5355    Ext4ExtRemoveSpaceFtraceEvent ext4_ext_remove_space = 169;
5356    Ext4ExtRemoveSpaceDoneFtraceEvent ext4_ext_remove_space_done = 170;
5357    Ext4ExtRmIdxFtraceEvent ext4_ext_rm_idx = 171;
5358    Ext4ExtRmLeafFtraceEvent ext4_ext_rm_leaf = 172;
5359    Ext4ExtShowExtentFtraceEvent ext4_ext_show_extent = 173;
5360    Ext4FallocateEnterFtraceEvent ext4_fallocate_enter = 174;
5361    Ext4FallocateExitFtraceEvent ext4_fallocate_exit = 175;
5362    Ext4FindDelallocRangeFtraceEvent ext4_find_delalloc_range = 176;
5363    Ext4ForgetFtraceEvent ext4_forget = 177;
5364    Ext4FreeBlocksFtraceEvent ext4_free_blocks = 178;
5365    Ext4FreeInodeFtraceEvent ext4_free_inode = 179;
5366    Ext4GetImpliedClusterAllocExitFtraceEvent
5367        ext4_get_implied_cluster_alloc_exit = 180;
5368    Ext4GetReservedClusterAllocFtraceEvent ext4_get_reserved_cluster_alloc =
5369        181;
5370    Ext4IndMapBlocksEnterFtraceEvent ext4_ind_map_blocks_enter = 182;
5371    Ext4IndMapBlocksExitFtraceEvent ext4_ind_map_blocks_exit = 183;
5372    Ext4InsertRangeFtraceEvent ext4_insert_range = 184;
5373    Ext4InvalidatepageFtraceEvent ext4_invalidatepage = 185;
5374    Ext4JournalStartFtraceEvent ext4_journal_start = 186;
5375    Ext4JournalStartReservedFtraceEvent ext4_journal_start_reserved = 187;
5376    Ext4JournalledInvalidatepageFtraceEvent ext4_journalled_invalidatepage =
5377        188;
5378    Ext4JournalledWriteEndFtraceEvent ext4_journalled_write_end = 189;
5379    Ext4LoadInodeFtraceEvent ext4_load_inode = 190;
5380    Ext4LoadInodeBitmapFtraceEvent ext4_load_inode_bitmap = 191;
5381    Ext4MarkInodeDirtyFtraceEvent ext4_mark_inode_dirty = 192;
5382    Ext4MbBitmapLoadFtraceEvent ext4_mb_bitmap_load = 193;
5383    Ext4MbBuddyBitmapLoadFtraceEvent ext4_mb_buddy_bitmap_load = 194;
5384    Ext4MbDiscardPreallocationsFtraceEvent ext4_mb_discard_preallocations = 195;
5385    Ext4MbNewGroupPaFtraceEvent ext4_mb_new_group_pa = 196;
5386    Ext4MbNewInodePaFtraceEvent ext4_mb_new_inode_pa = 197;
5387    Ext4MbReleaseGroupPaFtraceEvent ext4_mb_release_group_pa = 198;
5388    Ext4MbReleaseInodePaFtraceEvent ext4_mb_release_inode_pa = 199;
5389    Ext4MballocAllocFtraceEvent ext4_mballoc_alloc = 200;
5390    Ext4MballocDiscardFtraceEvent ext4_mballoc_discard = 201;
5391    Ext4MballocFreeFtraceEvent ext4_mballoc_free = 202;
5392    Ext4MballocPreallocFtraceEvent ext4_mballoc_prealloc = 203;
5393    Ext4OtherInodeUpdateTimeFtraceEvent ext4_other_inode_update_time = 204;
5394    Ext4PunchHoleFtraceEvent ext4_punch_hole = 205;
5395    Ext4ReadBlockBitmapLoadFtraceEvent ext4_read_block_bitmap_load = 206;
5396    Ext4ReadpageFtraceEvent ext4_readpage = 207;
5397    Ext4ReleasepageFtraceEvent ext4_releasepage = 208;
5398    Ext4RemoveBlocksFtraceEvent ext4_remove_blocks = 209;
5399    Ext4RequestBlocksFtraceEvent ext4_request_blocks = 210;
5400    Ext4RequestInodeFtraceEvent ext4_request_inode = 211;
5401    Ext4SyncFsFtraceEvent ext4_sync_fs = 212;
5402    Ext4TrimAllFreeFtraceEvent ext4_trim_all_free = 213;
5403    Ext4TrimExtentFtraceEvent ext4_trim_extent = 214;
5404    Ext4TruncateEnterFtraceEvent ext4_truncate_enter = 215;
5405    Ext4TruncateExitFtraceEvent ext4_truncate_exit = 216;
5406    Ext4UnlinkEnterFtraceEvent ext4_unlink_enter = 217;
5407    Ext4UnlinkExitFtraceEvent ext4_unlink_exit = 218;
5408    Ext4WriteBeginFtraceEvent ext4_write_begin = 219;
5409    // removed field with id 220;
5410    // removed field with id 221;
5411    // removed field with id 222;
5412    // removed field with id 223;
5413    // removed field with id 224;
5414    // removed field with id 225;
5415    // removed field with id 226;
5416    // removed field with id 227;
5417    // removed field with id 228;
5418    // removed field with id 229;
5419    Ext4WriteEndFtraceEvent ext4_write_end = 230;
5420    Ext4WritepageFtraceEvent ext4_writepage = 231;
5421    Ext4WritepagesFtraceEvent ext4_writepages = 232;
5422    Ext4WritepagesResultFtraceEvent ext4_writepages_result = 233;
5423    Ext4ZeroRangeFtraceEvent ext4_zero_range = 234;
5424    TaskNewtaskFtraceEvent task_newtask = 235;
5425    TaskRenameFtraceEvent task_rename = 236;
5426    SchedProcessExecFtraceEvent sched_process_exec = 237;
5427    SchedProcessExitFtraceEvent sched_process_exit = 238;
5428    SchedProcessForkFtraceEvent sched_process_fork = 239;
5429    SchedProcessFreeFtraceEvent sched_process_free = 240;
5430    SchedProcessHangFtraceEvent sched_process_hang = 241;
5431    SchedProcessWaitFtraceEvent sched_process_wait = 242;
5432    F2fsDoSubmitBioFtraceEvent f2fs_do_submit_bio = 243;
5433    F2fsEvictInodeFtraceEvent f2fs_evict_inode = 244;
5434    F2fsFallocateFtraceEvent f2fs_fallocate = 245;
5435    F2fsGetDataBlockFtraceEvent f2fs_get_data_block = 246;
5436    F2fsGetVictimFtraceEvent f2fs_get_victim = 247;
5437    F2fsIgetFtraceEvent f2fs_iget = 248;
5438    F2fsIgetExitFtraceEvent f2fs_iget_exit = 249;
5439    F2fsNewInodeFtraceEvent f2fs_new_inode = 250;
5440    F2fsReadpageFtraceEvent f2fs_readpage = 251;
5441    F2fsReserveNewBlockFtraceEvent f2fs_reserve_new_block = 252;
5442    F2fsSetPageDirtyFtraceEvent f2fs_set_page_dirty = 253;
5443    F2fsSubmitWritePageFtraceEvent f2fs_submit_write_page = 254;
5444    F2fsSyncFileEnterFtraceEvent f2fs_sync_file_enter = 255;
5445    F2fsSyncFileExitFtraceEvent f2fs_sync_file_exit = 256;
5446    F2fsSyncFsFtraceEvent f2fs_sync_fs = 257;
5447    F2fsTruncateFtraceEvent f2fs_truncate = 258;
5448    F2fsTruncateBlocksEnterFtraceEvent f2fs_truncate_blocks_enter = 259;
5449    F2fsTruncateBlocksExitFtraceEvent f2fs_truncate_blocks_exit = 260;
5450    F2fsTruncateDataBlocksRangeFtraceEvent f2fs_truncate_data_blocks_range =
5451        261;
5452    F2fsTruncateInodeBlocksEnterFtraceEvent f2fs_truncate_inode_blocks_enter =
5453        262;
5454    F2fsTruncateInodeBlocksExitFtraceEvent f2fs_truncate_inode_blocks_exit =
5455        263;
5456    F2fsTruncateNodeFtraceEvent f2fs_truncate_node = 264;
5457    F2fsTruncateNodesEnterFtraceEvent f2fs_truncate_nodes_enter = 265;
5458    F2fsTruncateNodesExitFtraceEvent f2fs_truncate_nodes_exit = 266;
5459    F2fsTruncatePartialNodesFtraceEvent f2fs_truncate_partial_nodes = 267;
5460    F2fsUnlinkEnterFtraceEvent f2fs_unlink_enter = 268;
5461    F2fsUnlinkExitFtraceEvent f2fs_unlink_exit = 269;
5462    F2fsVmPageMkwriteFtraceEvent f2fs_vm_page_mkwrite = 270;
5463    F2fsWriteBeginFtraceEvent f2fs_write_begin = 271;
5464    F2fsWriteCheckpointFtraceEvent f2fs_write_checkpoint = 272;
5465    F2fsWriteEndFtraceEvent f2fs_write_end = 273;
5466    AllocPagesIommuEndFtraceEvent alloc_pages_iommu_end = 274;
5467    AllocPagesIommuFailFtraceEvent alloc_pages_iommu_fail = 275;
5468    AllocPagesIommuStartFtraceEvent alloc_pages_iommu_start = 276;
5469    AllocPagesSysEndFtraceEvent alloc_pages_sys_end = 277;
5470    AllocPagesSysFailFtraceEvent alloc_pages_sys_fail = 278;
5471    AllocPagesSysStartFtraceEvent alloc_pages_sys_start = 279;
5472    DmaAllocContiguousRetryFtraceEvent dma_alloc_contiguous_retry = 280;
5473    IommuMapRangeFtraceEvent iommu_map_range = 281;
5474    IommuSecPtblMapRangeEndFtraceEvent iommu_sec_ptbl_map_range_end = 282;
5475    IommuSecPtblMapRangeStartFtraceEvent iommu_sec_ptbl_map_range_start = 283;
5476    IonAllocBufferEndFtraceEvent ion_alloc_buffer_end = 284;
5477    IonAllocBufferFailFtraceEvent ion_alloc_buffer_fail = 285;
5478    IonAllocBufferFallbackFtraceEvent ion_alloc_buffer_fallback = 286;
5479    IonAllocBufferStartFtraceEvent ion_alloc_buffer_start = 287;
5480    IonCpAllocRetryFtraceEvent ion_cp_alloc_retry = 288;
5481    IonCpSecureBufferEndFtraceEvent ion_cp_secure_buffer_end = 289;
5482    IonCpSecureBufferStartFtraceEvent ion_cp_secure_buffer_start = 290;
5483    IonPrefetchingFtraceEvent ion_prefetching = 291;
5484    IonSecureCmaAddToPoolEndFtraceEvent ion_secure_cma_add_to_pool_end = 292;
5485    IonSecureCmaAddToPoolStartFtraceEvent ion_secure_cma_add_to_pool_start =
5486        293;
5487    IonSecureCmaAllocateEndFtraceEvent ion_secure_cma_allocate_end = 294;
5488    IonSecureCmaAllocateStartFtraceEvent ion_secure_cma_allocate_start = 295;
5489    IonSecureCmaShrinkPoolEndFtraceEvent ion_secure_cma_shrink_pool_end = 296;
5490    IonSecureCmaShrinkPoolStartFtraceEvent ion_secure_cma_shrink_pool_start =
5491        297;
5492    KfreeFtraceEvent kfree = 298;
5493    KmallocFtraceEvent kmalloc = 299;
5494    KmallocNodeFtraceEvent kmalloc_node = 300;
5495    KmemCacheAllocFtraceEvent kmem_cache_alloc = 301;
5496    KmemCacheAllocNodeFtraceEvent kmem_cache_alloc_node = 302;
5497    KmemCacheFreeFtraceEvent kmem_cache_free = 303;
5498    MigratePagesEndFtraceEvent migrate_pages_end = 304;
5499    MigratePagesStartFtraceEvent migrate_pages_start = 305;
5500    MigrateRetryFtraceEvent migrate_retry = 306;
5501    MmPageAllocFtraceEvent mm_page_alloc = 307;
5502    MmPageAllocExtfragFtraceEvent mm_page_alloc_extfrag = 308;
5503    MmPageAllocZoneLockedFtraceEvent mm_page_alloc_zone_locked = 309;
5504    MmPageFreeFtraceEvent mm_page_free = 310;
5505    MmPageFreeBatchedFtraceEvent mm_page_free_batched = 311;
5506    MmPagePcpuDrainFtraceEvent mm_page_pcpu_drain = 312;
5507    RssStatFtraceEvent rss_stat = 313;
5508    IonHeapShrinkFtraceEvent ion_heap_shrink = 314;
5509    IonHeapGrowFtraceEvent ion_heap_grow = 315;
5510    FenceInitFtraceEvent fence_init = 316;
5511    FenceDestroyFtraceEvent fence_destroy = 317;
5512    FenceEnableSignalFtraceEvent fence_enable_signal = 318;
5513    FenceSignaledFtraceEvent fence_signaled = 319;
5514    ClkEnableFtraceEvent clk_enable = 320;
5515    ClkDisableFtraceEvent clk_disable = 321;
5516    ClkSetRateFtraceEvent clk_set_rate = 322;
5517    BinderTransactionAllocBufFtraceEvent binder_transaction_alloc_buf = 323;
5518    SignalDeliverFtraceEvent signal_deliver = 324;
5519    SignalGenerateFtraceEvent signal_generate = 325;
5520    OomScoreAdjUpdateFtraceEvent oom_score_adj_update = 326;
5521    GenericFtraceEvent generic = 327;
5522    MmEventRecordFtraceEvent mm_event_record = 328;
5523    SysEnterFtraceEvent sys_enter = 329;
5524    SysExitFtraceEvent sys_exit = 330;
5525    ZeroFtraceEvent zero = 331;
5526    GpuFrequencyFtraceEvent gpu_frequency = 332;
5527    SdeTracingMarkWriteFtraceEvent sde_tracing_mark_write = 333;
5528    MarkVictimFtraceEvent mark_victim = 334;
5529    IonStatFtraceEvent ion_stat = 335;
5530    IonBufferCreateFtraceEvent ion_buffer_create = 336;
5531    IonBufferDestroyFtraceEvent ion_buffer_destroy = 337;
5532    ScmCallStartFtraceEvent scm_call_start = 338;
5533    ScmCallEndFtraceEvent scm_call_end = 339;
5534    GpuMemTotalFtraceEvent gpu_mem_total = 340;
5535    ThermalTemperatureFtraceEvent thermal_temperature = 341;
5536    CdevUpdateFtraceEvent cdev_update = 342;
5537    CpuhpExitFtraceEvent cpuhp_exit = 343;
5538    CpuhpMultiEnterFtraceEvent cpuhp_multi_enter = 344;
5539    CpuhpEnterFtraceEvent cpuhp_enter = 345;
5540    CpuhpLatencyFtraceEvent cpuhp_latency = 346;
5541    FastrpcDmaStatFtraceEvent fastrpc_dma_stat = 347;
5542    DpuTracingMarkWriteFtraceEvent dpu_tracing_mark_write = 348;
5543    G2dTracingMarkWriteFtraceEvent g2d_tracing_mark_write = 349;
5544    MaliTracingMarkWriteFtraceEvent mali_tracing_mark_write = 350;
5545    DmaHeapStatFtraceEvent dma_heap_stat = 351;
5546    CpuhpPauseFtraceEvent cpuhp_pause = 352;
5547    SchedPiSetprioFtraceEvent sched_pi_setprio = 353;
5548    SdeSdeEvtlogFtraceEvent sde_sde_evtlog = 354;
5549    SdeSdePerfCalcCrtcFtraceEvent sde_sde_perf_calc_crtc = 355;
5550    SdeSdePerfCrtcUpdateFtraceEvent sde_sde_perf_crtc_update = 356;
5551    SdeSdePerfSetQosLutsFtraceEvent sde_sde_perf_set_qos_luts = 357;
5552    SdeSdePerfUpdateBusFtraceEvent sde_sde_perf_update_bus = 358;
5553  }
5554}
5555
5556// End of protos/perfetto/trace/ftrace/ftrace_event.proto
5557
5558// Begin of protos/perfetto/trace/ftrace/ftrace_event_bundle.proto
5559
5560// The result of tracing one or more ftrace data pages from a single per-cpu
5561// kernel ring buffer. If collating multiple pages' worth of events, all of
5562// them come from contiguous pages, with no kernel data loss in between.
5563message FtraceEventBundle {
5564  optional uint32 cpu = 1;
5565  repeated FtraceEvent event = 2;
5566  // Set to true if there was data loss between the last time we've read from
5567  // the corresponding per-cpu kernel buffer, and the earliest event recorded
5568  // in this bundle.
5569  optional bool lost_events = 3;
5570
5571  // Optionally-enabled compact encoding of a batch of scheduling events. Only
5572  // a subset of events & their fields is recorded.
5573  // All fields (except comms) are stored in a structure-of-arrays form, one
5574  // entry in each repeated field per event.
5575  message CompactSched {
5576    // Interned table of unique strings for this bundle.
5577    repeated string intern_table = 5;
5578
5579    // Delta-encoded timestamps across all sched_switch events within this
5580    // bundle. The first is absolute, each next one is relative to its
5581    // predecessor.
5582    repeated uint64 switch_timestamp = 1 [packed = true];
5583    repeated int64 switch_prev_state = 2 [packed = true];
5584    repeated int32 switch_next_pid = 3 [packed = true];
5585    repeated int32 switch_next_prio = 4 [packed = true];
5586    // One per event, index into |intern_table| corresponding to the
5587    // next_comm field of the event.
5588    repeated uint32 switch_next_comm_index = 6 [packed = true];
5589
5590    // Delta-encoded timestamps across all sched_waking events within this
5591    // bundle. The first is absolute, each next one is relative to its
5592    // predecessor.
5593    repeated uint64 waking_timestamp = 7 [packed = true];
5594    repeated int32 waking_pid = 8 [packed = true];
5595    repeated int32 waking_target_cpu = 9 [packed = true];
5596    repeated int32 waking_prio = 10 [packed = true];
5597    // One per event, index into |intern_table| corresponding to the
5598    // comm field of the event.
5599    repeated uint32 waking_comm_index = 11 [packed = true];
5600  }
5601  optional CompactSched compact_sched = 4;
5602}
5603
5604// End of protos/perfetto/trace/ftrace/ftrace_event_bundle.proto
5605
5606// Begin of protos/perfetto/trace/ftrace/ftrace_stats.proto
5607
5608// Per-CPU stats for the ftrace data source gathered from the kernel from
5609// /sys/kernel/debug/tracing/per_cpu/cpuX/stats.
5610message FtraceCpuStats {
5611  // CPU index.
5612  optional uint64 cpu = 1;
5613
5614  // Number of entries still in the kernel buffer. Ideally this should be close
5615  // to zero, as events are consumed regularly and moved into the userspace
5616  // buffers (or file).
5617  optional uint64 entries = 2;
5618
5619  // Number of events lost in kernel buffers due to overwriting of old events
5620  // before userspace had a chance to drain them.
5621  optional uint64 overrun = 3;
5622
5623  // This should always be zero. If not the buffer size is way too small or
5624  // something went wrong with the tracer.
5625  optional uint64 commit_overrun = 4;
5626
5627  // Bytes actually read (not overwritten).
5628  optional uint64 bytes_read = 5;
5629
5630  // The timestamp for the oldest event still in the ring buffer.
5631  optional double oldest_event_ts = 6;
5632
5633  // The current timestamp.
5634  optional double now_ts = 7;
5635
5636  // If the kernel buffer has overwrite mode disabled, this will show the number
5637  // of new events that were lost because the buffer was full. This is similar
5638  // to |overrun| but only for the overwrite=false case.
5639  optional uint64 dropped_events = 8;
5640
5641  // The number of events read.
5642  optional uint64 read_events = 9;
5643}
5644
5645// Ftrace stats for all CPUs.
5646message FtraceStats {
5647  enum Phase {
5648    UNSPECIFIED = 0;
5649    START_OF_TRACE = 1;
5650    END_OF_TRACE = 2;
5651  }
5652
5653  // Tells when stats were sampled. There should be one sample at the beginning
5654  // of the trace and one sample at the end.
5655  optional Phase phase = 1;
5656
5657  // Per-CPU stats (one entry for each CPU).
5658  repeated FtraceCpuStats cpu_stats = 2;
5659
5660  // When FtraceConfig.symbolize_ksyms = true, this records the number of
5661  // symbols parsed from /proc/kallsyms, whether they have been seen in the
5662  // trace or not. It can be used to debug kptr_restrict or security-related
5663  // errors.
5664  // Note: this will be valid only when phase = END_OF_TRACE. The symbolizer is
5665  // initialized. When START_OF_TRACE is emitted it is not ready yet.
5666  optional uint32 kernel_symbols_parsed = 3;
5667
5668  // The memory used by the kernel symbolizer (KernelSymbolMap.size_bytes()).
5669  optional uint32 kernel_symbols_mem_kb = 4;
5670}
5671
5672// End of protos/perfetto/trace/ftrace/ftrace_stats.proto
5673
5674// Begin of protos/perfetto/trace/gpu/gpu_counter_event.proto
5675
5676message GpuCounterEvent {
5677  // The first trace packet of each session should include counter_spec.
5678  optional GpuCounterDescriptor counter_descriptor = 1;
5679
5680  message GpuCounter {
5681    // required. Identifier for counter.
5682    optional uint32 counter_id = 1;
5683    // required. Value of the counter.
5684    oneof value {
5685      int64 int_value = 2;
5686      double double_value = 3;
5687    }
5688  }
5689  repeated GpuCounter counters = 2;
5690
5691  // optional. Identifier for GPU in a multi-gpu device.
5692  optional int32 gpu_id = 3;
5693}
5694
5695// End of protos/perfetto/trace/gpu/gpu_counter_event.proto
5696
5697// Begin of protos/perfetto/trace/gpu/gpu_log.proto
5698
5699// Message for logging events GPU data producer.
5700message GpuLog {
5701  enum Severity {
5702    LOG_SEVERITY_UNSPECIFIED = 0;
5703    LOG_SEVERITY_VERBOSE = 1;
5704    LOG_SEVERITY_DEBUG = 2;
5705    LOG_SEVERITY_INFO = 3;
5706    LOG_SEVERITY_WARNING = 4;
5707    LOG_SEVERITY_ERROR = 5;
5708  };
5709  optional Severity severity = 1;
5710
5711  optional string tag = 2;
5712
5713  optional string log_message = 3;
5714}
5715
5716// End of protos/perfetto/trace/gpu/gpu_log.proto
5717
5718// Begin of protos/perfetto/trace/gpu/gpu_render_stage_event.proto
5719
5720// next id: 15
5721message GpuRenderStageEvent {
5722  // required. Unique ID for the event.
5723  optional uint64 event_id = 1;
5724
5725  // optional. Duration of the event in nanoseconds. If unset, this is a
5726  // single time point event.
5727  optional uint64 duration = 2;
5728
5729  // required. ID to a hardware queue description in the specifications.
5730  // InternedGpuRenderStageSpecification
5731  optional uint64 hw_queue_iid = 13;
5732
5733  // required. ID to a render stage description in the specifications.
5734  // InternedGpuRenderStageSpecification
5735  optional uint64 stage_iid = 14;
5736
5737  // optional. Identifier for GPU in a multi-gpu device.
5738  optional int32 gpu_id = 11;
5739
5740  // required. Graphics context for the event.
5741  // For OpenGL, this is the GL context.
5742  // For Vulkan, this is the VkDevice.
5743  optional uint64 context = 5;
5744
5745  // optional. The render target for this event.
5746  // For OpenGL, this is the GL frame buffer handle.
5747  // For Vulkan, this is the VkFrameBuffer handle.
5748  optional uint64 render_target_handle = 8;
5749
5750  // optional. Submission ID generated by the UMD.
5751  // For OpenGL, the ID should map to an API submission (e.g., glFlush,
5752  // glFinish, eglSwapBufffers) event.  The set of submissions to the HW due
5753  // to a single API submission should share the same ID.
5754  // For Vulkan, it should map 1:1 with a vkQueueSubmit.
5755  optional uint32 submission_id = 10;
5756
5757  // optional. Additional data for the user. This may include attributes for
5758  // the event like resource ids, shaders, etc.
5759  message ExtraData {
5760    optional string name = 1;
5761    optional string value = 2;
5762  }
5763  repeated ExtraData extra_data = 6;
5764
5765  // VULKAN SPECIFICS
5766
5767  // optional. The Vulkan render pass handle.
5768  optional uint64 render_pass_handle = 9;
5769
5770  // optional. A bit mask representing which render subpasses contributed to
5771  // this render stage event.  Subpass index 0 is represented by setting the
5772  // LSB of the mask.  Additional mask can be added for subpass index greater
5773  // than 63.
5774  repeated uint64 render_subpass_index_mask = 15;
5775
5776  // optional. The Vulkan command buffer handle.
5777  optional uint64 command_buffer_handle = 12;
5778
5779  // DEPRECATED
5780
5781  // Deprecated.  Use InternedGpuRenderStageSpecification instead.
5782  // The first trace packet of each session should include a Specifications
5783  // to enumerate *all* IDs that will be used. The timestamp of this packet
5784  // must be earlier than all other packets. Only one packet with Specifications
5785  // is expected.
5786  message Specifications {
5787    message ContextSpec {
5788      optional uint64 context = 1;
5789      optional int32 pid = 2;
5790    }
5791    optional ContextSpec context_spec = 1;
5792
5793    message Description {
5794      optional string name = 1;
5795      optional string description = 2;
5796    }
5797
5798    // Labels to categorize the hw Queue this event goes on.
5799    repeated Description hw_queue = 2;
5800
5801    // Labels to categorize render stage(binning, render, compute etc).
5802    repeated Description stage = 3;
5803  }
5804  // Deprecated.  Use hw_queue_iid and stage_iid to refer to
5805  // InternedGpuRenderStageSpecification instead.
5806  optional Specifications specifications = 7 [deprecated = true];
5807
5808  // Deprecated. Use hw_queue_iid instead;
5809  optional int32 hw_queue_id = 3 [deprecated = true];
5810
5811  // Deprecated. Use stage_iid instead;
5812  optional int32 stage_id = 4 [deprecated = true];
5813
5814  // Extension for vendor's custom proto.
5815  extensions 100;
5816}
5817
5818// Interned data.
5819
5820// The iid is the numeric value of either the GL Context or the VkDevice
5821// handle.
5822message InternedGraphicsContext {
5823  optional uint64 iid = 1;
5824  optional int32 pid = 2;
5825  enum Api {
5826    UNDEFINED = 0;
5827    OPEN_GL = 1;
5828    VULKAN = 2;
5829    OPEN_CL = 3;
5830  }
5831  optional Api api = 3;
5832}
5833
5834message InternedGpuRenderStageSpecification {
5835  optional uint64 iid = 1;
5836  optional string name = 2;
5837  optional string description = 3;
5838
5839  enum RenderStageCategory {
5840    OTHER = 0;
5841    GRAPHICS = 1;
5842    COMPUTE = 2;
5843  }
5844  optional RenderStageCategory category = 4;
5845}
5846
5847// End of protos/perfetto/trace/gpu/gpu_render_stage_event.proto
5848
5849// Begin of protos/perfetto/trace/gpu/vulkan_api_event.proto
5850
5851// Message for recording the Vulkan call.
5852message VulkanApiEvent {
5853  oneof event {
5854    VkDebugUtilsObjectName vk_debug_utils_object_name = 1;
5855    VkQueueSubmit vk_queue_submit = 2;
5856  }
5857
5858  // For recording vkSetDebugUtilsObjectNameEXT and
5859  // vkDebugMarkerSetObjectNameEXT
5860  message VkDebugUtilsObjectName {
5861    optional uint32 pid = 1;
5862    optional uint64 vk_device = 2;
5863    // VkObjectType.  Value must match
5864    // https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkObjectType.html.
5865    optional int32 object_type = 3;
5866    optional uint64 object = 4;
5867    optional string object_name = 5;
5868  }
5869
5870  // For recording vkQueueSubmit call.
5871  message VkQueueSubmit {
5872    optional uint64 duration_ns = 1;
5873    optional uint32 pid = 2;
5874    optional uint32 tid = 3;
5875    optional uint64 vk_queue = 4;
5876    repeated uint64 vk_command_buffers = 5;
5877    // Submission ID.  An identifier unique to each vkQueueSubmit call.  This
5878    // submission_id must match GpuRenderStageEvent.submission_id if the
5879    // GpuRenderStageEvent is created due to this vkQueueSubmit.
5880    optional uint32 submission_id = 6;
5881  }
5882}
5883
5884// End of protos/perfetto/trace/gpu/vulkan_api_event.proto
5885
5886// Begin of protos/perfetto/trace/gpu/vulkan_memory_event.proto
5887
5888// All the information that cannot be sent within a VulkanMemoryEvent message,
5889// are sent as annotations to the main memory event. One example is the
5890// properties of the object that consumes the allocated memory, for example, a
5891// buffer or an image.
5892// key_iid and string_iid are both interned strings. Original string value is
5893// stored in vulkan_memory_keys from
5894// protos/perfetto/trace/interned_data/interned_data.proto.
5895message VulkanMemoryEventAnnotation {
5896  optional uint64 key_iid = 1;
5897  oneof value {
5898    int64 int_value = 2;
5899    double double_value = 3;
5900    uint64 string_iid = 4;
5901  }
5902}
5903
5904// Each VulkanMemoryEvent encompasses information regarding one single function
5905// call that results in reserving, binding or freeing host or GPU memory. There
5906// is a special message type, ANNOTATIONS, which is used to communicate
5907// information that are not directly related to a memory event, nonetheless are
5908// essential to understand the memory usage. An example is the size and memory
5909// types of the memory heaps.
5910//
5911// Next reserved id: 10 (up to 15).
5912// Next id: 21.
5913message VulkanMemoryEvent {
5914  enum Source {
5915    SOURCE_UNSPECIFIED = 0;
5916    SOURCE_DRIVER = 1;
5917    SOURCE_DEVICE = 2;
5918    SOURCE_DEVICE_MEMORY = 3;
5919    SOURCE_BUFFER = 4;
5920    SOURCE_IMAGE = 5;
5921  }
5922
5923  enum Operation {
5924    OP_UNSPECIFIED = 0;
5925
5926    // alloc, create
5927    OP_CREATE = 1;
5928
5929    // free, destroy(non-bound)
5930    OP_DESTROY = 2;
5931
5932    // bind buffer and image
5933    OP_BIND = 3;
5934
5935    // destroy (bound)
5936    OP_DESTROY_BOUND = 4;
5937
5938    // only annotations
5939    OP_ANNOTATIONS = 5;
5940  }
5941
5942  enum AllocationScope {
5943    SCOPE_UNSPECIFIED = 0;
5944    SCOPE_COMMAND = 1;
5945    SCOPE_OBJECT = 2;
5946    SCOPE_CACHE = 3;
5947    SCOPE_DEVICE = 4;
5948    SCOPE_INSTANCE = 5;
5949  }
5950
5951  optional Source source = 1;
5952  optional Operation operation = 2;
5953  optional int64 timestamp = 3;
5954  optional uint32 pid = 4;
5955  optional fixed64 memory_address = 5;
5956  optional uint64 memory_size = 6;
5957  // Interned string. Original string value is stored in function_names from
5958  // protos/perfetto/trace/interned_data/interned_data.proto.
5959  optional uint64 caller_iid = 7;
5960  optional AllocationScope allocation_scope = 8;
5961  // Extra related information, e.g., create configs, etc.
5962  repeated VulkanMemoryEventAnnotation annotations = 9;
5963
5964  // Field IDs used for device memory (low sampling rate)
5965  optional fixed64 device = 16;
5966  optional fixed64 device_memory = 17;
5967  optional uint32 memory_type = 18;
5968  optional uint32 heap = 19;
5969  optional fixed64 object_handle = 20;
5970}
5971
5972// End of protos/perfetto/trace/gpu/vulkan_memory_event.proto
5973
5974// Begin of protos/perfetto/trace/profiling/profile_common.proto
5975
5976// TODO(fmayer): Figure out naming thoroughout this file to get a
5977// nomenclature that works between Windows and Linux.
5978
5979// The interning fields in this file can refer to 2 different intern tables,
5980// depending on the message they are used in. If the interned fields are present
5981// in ProfilePacket proto, then the intern tables included in the ProfilePacket
5982// should be used. If the intered fields are present in the
5983// StreamingProfilePacket proto, then the intern tables included in all of the
5984// previous InternedData message with same sequence ID should be used.
5985// TODO(fmayer): Move to the intern tables to a common location.
5986message InternedString {
5987  optional uint64 iid = 1;
5988  optional bytes str = 2;
5989}
5990
5991// A symbol field that is emitted after the trace is written. These tables would
5992// be appended as the last packets in the trace that the profiler will use, so
5993// that the actual trace need not be rewritten to symbolize the profiles.
5994message ProfiledFrameSymbols {
5995  // Use the frame id as the interning key for the symbols.
5996  optional uint64 frame_iid = 1;
5997
5998  // These are repeated because when inlining happens, multiple functions'
5999  // frames can be at a single address. Imagine function Foo calling the
6000  // std::vector<int> constructor, which gets inlined at 0xf00. We then get
6001  // both Foo and the std::vector<int> constructor when we symbolize the
6002  // address.
6003
6004  // key to InternedString
6005  repeated uint64 function_name_id = 2;
6006
6007  // key to InternedString
6008  repeated uint64 file_name_id = 3;
6009
6010  repeated uint32 line_number = 4;
6011}
6012
6013message Line {
6014  optional string function_name = 1;
6015  optional string source_file_name = 2;
6016  optional uint32 line_number = 3;
6017}
6018
6019// Symbols for a given address in a module.
6020message AddressSymbols {
6021  optional uint64 address = 1;
6022
6023  // Source lines that correspond to this address.
6024  //
6025  // These are repeated because when inlining happens, multiple functions'
6026  // frames can be at a single address. Imagine function Foo calling the
6027  // std::vector<int> constructor, which gets inlined at 0xf00. We then get
6028  // both Foo and the std::vector<int> constructor when we symbolize the
6029  // address.
6030  repeated Line lines = 2;
6031}
6032
6033// Symbols for addresses seen in a module.
6034message ModuleSymbols {
6035  // Fully qualified path to the mapping.
6036  // E.g. /system/lib64/libc.so.
6037  optional string path = 1;
6038
6039  // .note.gnu.build-id on Linux (not hex encoded).
6040  // uuid on MacOS.
6041  // Module GUID on Windows.
6042  optional string build_id = 2;
6043  repeated AddressSymbols address_symbols = 3;
6044}
6045
6046message Mapping {
6047  // Interning key.
6048  optional uint64 iid = 1;
6049
6050  // Interning key.
6051  optional uint64 build_id = 2;
6052
6053  // The linker may create multiple memory mappings for the same shared
6054  // library.
6055  // This is so that the ELF header is mapped as read only, while the
6056  // executable memory is mapped as executable only.
6057  // The details of this depend on the linker, a possible mapping of an ELF
6058  // file is this:
6059  //         +----------------------+
6060  // ELF     |xxxxxxxxxyyyyyyyyyyyyy|
6061  //         +---------+------------+
6062  //         |         |
6063  //         | read    | executable
6064  //         v mapping v mapping
6065  //         +----------------------+
6066  // Memory  |xxxxxxxxx|yyyyyyyyyyyy|
6067  //         +------------------+---+
6068  //         ^         ^        ^
6069  //         +         +        +
6070  //       start     exact    relpc
6071  //       offset   offset    0x1800
6072  //       0x0000   0x1000
6073  //
6074  // exact_offset is the offset into the library file of this mapping.
6075  // start_offset is the offset into the library file of the first mapping
6076  // for that library. For native libraries (.so files) this should be 0.
6077
6078  // This is not set on Android 10.
6079  optional uint64 exact_offset = 8;
6080
6081  optional uint64 start_offset = 3;
6082  optional uint64 start = 4;
6083  optional uint64 end = 5;
6084  optional uint64 load_bias = 6;
6085
6086  // E.g. ["system", "lib64", "libc.so"]
6087  // id of string.
6088  repeated uint64 path_string_ids = 7;
6089}
6090
6091message Frame {
6092  // Interning key
6093  optional uint64 iid = 1;
6094
6095  // E.g. "fopen"
6096  // id of string.
6097  optional uint64 function_name_id = 2;
6098
6099  optional uint64 mapping_id = 3;
6100  optional uint64 rel_pc = 4;
6101}
6102
6103message Callstack {
6104  optional uint64 iid = 1;
6105  // Frames of this callstack. Bottom frame first.
6106  repeated uint64 frame_ids = 2;
6107}
6108
6109// End of protos/perfetto/trace/profiling/profile_common.proto
6110
6111// Begin of protos/perfetto/trace/track_event/chrome_histogram_sample.proto
6112
6113message HistogramName {
6114  optional uint64 iid = 1;
6115  optional string name = 2;
6116}
6117
6118// An individual histogram sample logged via Chrome's UMA metrics system.
6119message ChromeHistogramSample {
6120  // MD5 hash of the metric name. Either |name_hash| or |name|/|name_iid| or
6121  // both must be present.
6122  optional uint64 name_hash = 1;
6123  optional string name = 2;
6124  optional int64 sample = 3;
6125  // Interned HistogramName. Only one of |name|, |name_iid| can be set.
6126  optional uint64 name_iid = 4;
6127}
6128
6129// End of protos/perfetto/trace/track_event/chrome_histogram_sample.proto
6130
6131// Begin of protos/perfetto/trace/track_event/debug_annotation.proto
6132
6133// Proto representation of untyped key/value annotations provided in TRACE_EVENT
6134// macros. Users of the Perfetto SDK should prefer to use the
6135// perfetto::TracedValue API to fill these protos, rather than filling them
6136// manually.
6137//
6138// Debug annotations are intended for debug use and are not considered a stable
6139// API of the trace contents. Trace-based metrics that use debug annotation
6140// values are prone to breakage, so please rely on typed TrackEvent fields for
6141// these instead.
6142//
6143// DebugAnnotations support nested arrays and dictionaries. Each entry is
6144// encoded as a single DebugAnnotation message. Only dictionary entries
6145// set the "name" field. The TrackEvent message forms an implicit root
6146// dictionary.
6147//
6148// Example TrackEvent with nested annotations:
6149//   track_event {
6150//     debug_annotations {
6151//       name: "foo"
6152//       dict_entries {
6153//         name: "a"
6154//         bool_value: true
6155//       }
6156//       dict_entries {
6157//         name: "b"
6158//         int_value: 123
6159//       }
6160//     }
6161//     debug_annotations {
6162//       name: "bar"
6163//       array_values {
6164//         string_value: "hello"
6165//       }
6166//       array_values {
6167//         string_value: "world"
6168//       }
6169//     }
6170//   }
6171//
6172// Next ID: 13.
6173message DebugAnnotation {
6174  // Name fields are set only for dictionary entries.
6175  oneof name_field {
6176    // interned DebugAnnotationName.
6177    uint64 name_iid = 1;
6178    // non-interned variant.
6179    string name = 10;
6180  }
6181
6182  oneof value {
6183    bool bool_value = 2;
6184    uint64 uint_value = 3;
6185    int64 int_value = 4;
6186    double double_value = 5;
6187    string string_value = 6;
6188    // Pointers are stored in a separate type as the JSON output treats them
6189    // differently from other uint64 values.
6190    uint64 pointer_value = 7;
6191
6192    // Deprecated. Use dict_entries / array_values instead.
6193    NestedValue nested_value = 8;
6194
6195    // Legacy instrumentation may not support conversion of nested data to
6196    // NestedValue yet.
6197    string legacy_json_value = 9;
6198  }
6199
6200  repeated DebugAnnotation dict_entries = 11;
6201  repeated DebugAnnotation array_values = 12;
6202
6203  // Deprecated legacy way to use nested values. Only kept for
6204  // backwards-compatibility in TraceProcessor. May be removed in the future -
6205  // code filling protos should use |dict_entries| and |array_values| instead.
6206  message NestedValue {
6207    enum NestedType {
6208      // leaf value.
6209      UNSPECIFIED = 0;
6210      DICT = 1;
6211      ARRAY = 2;
6212    }
6213    optional NestedType nested_type = 1;
6214
6215    repeated string dict_keys = 2;
6216    repeated NestedValue dict_values = 3;
6217    repeated NestedValue array_values = 4;
6218    optional int64 int_value = 5;
6219    optional double double_value = 6;
6220    optional bool bool_value = 7;
6221    optional string string_value = 8;
6222  }
6223}
6224
6225// --------------------
6226// Interned data types:
6227// --------------------
6228
6229message DebugAnnotationName {
6230  optional uint64 iid = 1;
6231  optional string name = 2;
6232}
6233
6234// End of protos/perfetto/trace/track_event/debug_annotation.proto
6235
6236// Begin of protos/perfetto/trace/track_event/log_message.proto
6237
6238message LogMessage {
6239  // interned SourceLocation.
6240  optional uint64 source_location_iid = 1;
6241  // interned LogMessageBody.
6242  optional uint64 body_iid = 2;
6243}
6244
6245// --------------------
6246// Interned data types:
6247// --------------------
6248
6249message LogMessageBody {
6250  optional uint64 iid = 1;
6251  optional string body = 2;
6252}
6253// End of protos/perfetto/trace/track_event/log_message.proto
6254
6255// Begin of protos/perfetto/trace/track_event/source_location.proto
6256
6257// --------------------
6258// Interned data types:
6259// --------------------
6260
6261message SourceLocation {
6262  optional uint64 iid = 1;
6263
6264  // We intend to add a binary symbol version of this in the future.
6265  optional string file_name = 2;
6266  optional string function_name = 3;
6267  optional uint32 line_number = 4;
6268}
6269
6270// End of protos/perfetto/trace/track_event/source_location.proto
6271
6272// Begin of protos/perfetto/trace/track_event/chrome_application_state_info.proto
6273
6274
6275// Trace event arguments for application state changes.
6276message ChromeApplicationStateInfo {
6277  // Enum definition taken from:
6278  // https://source.chromium.org/chromium/chromium/src/+/master:base/android/application_status_listener.h
6279  enum ChromeApplicationState {
6280    APPLICATION_STATE_UNKNOWN = 0;
6281    APPLICATION_STATE_HAS_RUNNING_ACTIVITIES = 1;
6282    APPLICATION_STATE_HAS_PAUSED_ACTIVITIES = 2;
6283    APPLICATION_STATE_HAS_STOPPED_ACTIVITIES = 3;
6284    APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES = 4;
6285  };
6286  optional ChromeApplicationState application_state = 1;
6287}
6288
6289// End of protos/perfetto/trace/track_event/chrome_application_state_info.proto
6290
6291// Begin of protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.proto
6292
6293// Describes Chrome's Compositor scheduler's current state and associated
6294// variables.
6295//
6296// These protos and enums were adapted from the corresponding original JSON
6297// trace event for the scheduler state. In contrast to the JSON, we use strongly
6298// typed enum values instead of strings for many fields, and
6299// microsecond-granularity timestamps.
6300//
6301// The original format was generated in JSON by the code at
6302// https://cs.chromium.org/chromium/src/cc/scheduler/scheduler.cc?l=870&rcl=5e15eabc9c0eec8daf94fdf78e93f13b6e3b63dd
6303//
6304// TODO(nuskos): Update link once we've switched to writing this proto.
6305//
6306// All non-delta-timestamps are absolute CLOCK_MONOTONIC timestamps.
6307
6308enum ChromeCompositorSchedulerAction {
6309  CC_SCHEDULER_ACTION_UNSPECIFIED = 0;
6310  CC_SCHEDULER_ACTION_NONE = 1;
6311  CC_SCHEDULER_ACTION_SEND_BEGIN_MAIN_FRAME = 2;
6312  CC_SCHEDULER_ACTION_COMMIT = 3;
6313  CC_SCHEDULER_ACTION_ACTIVATE_SYNC_TREE = 4;
6314  CC_SCHEDULER_ACTION_DRAW_IF_POSSIBLE = 5;
6315  CC_SCHEDULER_ACTION_DRAW_FORCED = 6;
6316  CC_SCHEDULER_ACTION_DRAW_ABORT = 7;
6317  CC_SCHEDULER_ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION = 8;
6318  CC_SCHEDULER_ACTION_PREPARE_TILES = 9;
6319  CC_SCHEDULER_ACTION_INVALIDATE_LAYER_TREE_FRAME_SINK = 10;
6320  CC_SCHEDULER_ACTION_PERFORM_IMPL_SIDE_INVALIDATION = 11;
6321  CC_SCHEDULER_ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_EXPECTED_UNTIL = 12;
6322  CC_SCHEDULER_ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_EXPECTED_SOON = 13;
6323}
6324
6325// Next id: 18
6326message ChromeCompositorSchedulerState {
6327  enum BeginImplFrameDeadlineMode {
6328    DEADLINE_MODE_UNSPECIFIED = 0;
6329    DEADLINE_MODE_NONE = 1;
6330    DEADLINE_MODE_IMMEDIATE = 2;
6331    DEADLINE_MODE_REGULAR = 3;
6332    DEADLINE_MODE_LATE = 4;
6333    DEADLINE_MODE_BLOCKED = 5;
6334  }
6335  optional ChromeCompositorStateMachine state_machine = 1;
6336  optional bool observing_begin_frame_source = 2;
6337  optional bool begin_impl_frame_deadline_task = 3;
6338  optional bool pending_begin_frame_task = 4;
6339  optional bool skipped_last_frame_missed_exceeded_deadline = 5;
6340  optional bool skipped_last_frame_to_reduce_latency = 6;
6341  optional ChromeCompositorSchedulerAction inside_action = 7;
6342  optional BeginImplFrameDeadlineMode deadline_mode = 8;
6343  optional int64 deadline_us = 9;
6344  optional int64 deadline_scheduled_at_us = 10;
6345  optional int64 now_us = 11;
6346  optional int64 now_to_deadline_delta_us = 12;
6347  optional int64 now_to_deadline_scheduled_at_delta_us = 13;
6348  optional BeginImplFrameArgs begin_impl_frame_args = 14;
6349  optional BeginFrameObserverState begin_frame_observer_state = 15;
6350  optional BeginFrameSourceState begin_frame_source_state = 16;
6351  optional CompositorTimingHistory compositor_timing_history = 17;
6352}
6353
6354// Describes the current values stored in the Chrome Compositor state machine.
6355// Next id: 3
6356message ChromeCompositorStateMachine {
6357  // Next id: 6
6358  message MajorState {
6359    enum BeginImplFrameState {
6360      BEGIN_IMPL_FRAME_UNSPECIFIED = 0;
6361      BEGIN_IMPL_FRAME_IDLE = 1;
6362      BEGIN_IMPL_FRAME_INSIDE_BEGIN_FRAME = 2;
6363      BEGIN_IMPL_FRAME_INSIDE_DEADLINE = 3;
6364    }
6365    enum BeginMainFrameState {
6366      BEGIN_MAIN_FRAME_UNSPECIFIED = 0;
6367      BEGIN_MAIN_FRAME_IDLE = 1;
6368      BEGIN_MAIN_FRAME_SENT = 2;
6369      BEGIN_MAIN_FRAME_READY_TO_COMMIT = 3;
6370    }
6371    enum LayerTreeFrameSinkState {
6372      LAYER_TREE_FRAME_UNSPECIFIED = 0;
6373      LAYER_TREE_FRAME_NONE = 1;
6374      LAYER_TREE_FRAME_ACTIVE = 2;
6375      LAYER_TREE_FRAME_CREATING = 3;
6376      LAYER_TREE_FRAME_WAITING_FOR_FIRST_COMMIT = 4;
6377      LAYER_TREE_FRAME_WAITING_FOR_FIRST_ACTIVATION = 5;
6378    }
6379    enum ForcedRedrawOnTimeoutState {
6380      FORCED_REDRAW_UNSPECIFIED = 0;
6381      FORCED_REDRAW_IDLE = 1;
6382      FORCED_REDRAW_WAITING_FOR_COMMIT = 2;
6383      FORCED_REDRAW_WAITING_FOR_ACTIVATION = 3;
6384      FORCED_REDRAW_WAITING_FOR_DRAW = 4;
6385    }
6386    optional ChromeCompositorSchedulerAction next_action = 1;
6387    optional BeginImplFrameState begin_impl_frame_state = 2;
6388    optional BeginMainFrameState begin_main_frame_state = 3;
6389    optional LayerTreeFrameSinkState layer_tree_frame_sink_state = 4;
6390    optional ForcedRedrawOnTimeoutState forced_redraw_state = 5;
6391  }
6392  optional MajorState major_state = 1;
6393
6394  // Next id: 47
6395  message MinorState {
6396    enum TreePriority {
6397      TREE_PRIORITY_UNSPECIFIED = 0;
6398      TREE_PRIORITY_SAME_PRIORITY_FOR_BOTH_TREES = 1;
6399      TREE_PRIORITY_SMOOTHNESS_TAKES_PRIORITY = 2;
6400      TREE_PRIORITY_NEW_CONTENT_TAKES_PRIORITY = 3;
6401    }
6402    enum ScrollHandlerState {
6403      SCROLL_HANDLER_UNSPECIFIED = 0;
6404      SCROLL_AFFECTS_SCROLL_HANDLER = 1;
6405      SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER = 2;
6406    }
6407    optional int32 commit_count = 1;
6408    optional int32 current_frame_number = 2;
6409    optional int32 last_frame_number_submit_performed = 3;
6410    optional int32 last_frame_number_draw_performed = 4;
6411    optional int32 last_frame_number_begin_main_frame_sent = 5;
6412    optional bool did_draw = 6;
6413    optional bool did_send_begin_main_frame_for_current_frame = 7;
6414    optional bool did_notify_begin_main_frame_not_expected_until = 8;
6415    optional bool did_notify_begin_main_frame_not_expected_soon = 9;
6416    optional bool wants_begin_main_frame_not_expected = 10;
6417    optional bool did_commit_during_frame = 11;
6418    optional bool did_invalidate_layer_tree_frame_sink = 12;
6419    optional bool did_perform_impl_side_invalidaion = 13;
6420    optional bool did_prepare_tiles = 14;
6421    optional int32 consecutive_checkerboard_animations = 15;
6422    optional int32 pending_submit_frames = 16;
6423    optional int32 submit_frames_with_current_layer_tree_frame_sink = 17;
6424    optional bool needs_redraw = 18;
6425    optional bool needs_prepare_tiles = 19;
6426    optional bool needs_begin_main_frame = 20;
6427    optional bool needs_one_begin_impl_frame = 21;
6428    optional bool visible = 22;
6429    optional bool begin_frame_source_paused = 23;
6430    optional bool can_draw = 24;
6431    optional bool resourceless_draw = 25;
6432    optional bool has_pending_tree = 26;
6433    optional bool pending_tree_is_ready_for_activation = 27;
6434    optional bool active_tree_needs_first_draw = 28;
6435    optional bool active_tree_is_ready_to_draw = 29;
6436    optional bool did_create_and_initialize_first_layer_tree_frame_sink = 30;
6437    optional TreePriority tree_priority = 31;
6438    optional ScrollHandlerState scroll_handler_state = 32;
6439    optional bool critical_begin_main_frame_to_activate_is_fast = 33;
6440    optional bool main_thread_missed_last_deadline = 34;
6441    optional bool skip_next_begin_main_frame_to_reduce_latency = 35;
6442    optional bool video_needs_begin_frames = 36;
6443    optional bool defer_begin_main_frame = 37;
6444    optional bool last_commit_had_no_updates = 38;
6445    optional bool did_draw_in_last_frame = 39;
6446    optional bool did_submit_in_last_frame = 40;
6447    optional bool needs_impl_side_invalidation = 41;
6448    optional bool current_pending_tree_is_impl_side = 42;
6449    optional bool previous_pending_tree_was_impl_side = 43;
6450    optional bool processing_animation_worklets_for_active_tree = 44;
6451    optional bool processing_animation_worklets_for_pending_tree = 45;
6452    optional bool processing_paint_worklets_for_pending_tree = 46;
6453  }
6454  optional MinorState minor_state = 2;
6455}
6456
6457// Next id: 12
6458message BeginFrameArgs {
6459  // JSON format has a "type" field that was always just "BeginFrameArgs" we
6460  // drop this in the proto representation, and instead make the JSON format
6461  // "subtype" field become the type field.
6462  enum BeginFrameArgsType {
6463    BEGIN_FRAME_ARGS_TYPE_UNSPECIFIED = 0;
6464    BEGIN_FRAME_ARGS_TYPE_INVALID = 1;
6465    BEGIN_FRAME_ARGS_TYPE_NORMAL = 2;
6466    BEGIN_FRAME_ARGS_TYPE_MISSED = 3;
6467  }
6468  optional BeginFrameArgsType type = 1;
6469  optional uint64 source_id = 2;
6470  optional uint64 sequence_number = 3;
6471  optional int64 frame_time_us = 4;
6472  optional int64 deadline_us = 5;
6473  optional int64 interval_delta_us = 6;
6474  optional bool on_critical_path = 7;
6475  optional bool animate_only = 8;
6476  oneof created_from {
6477    // The interned SourceLocation.
6478    uint64 source_location_iid = 9;
6479    // The SourceLocation that this args was created from.
6480    // TODO(nuskos): Eventually we will support interning inside of
6481    // TypedArgument TraceEvents and then we shouldn't need this SourceLocation
6482    // since we can emit it as part of the InternedData message. When we can
6483    // remove this |source_location|.
6484    SourceLocation source_location = 10;
6485  }
6486}
6487
6488// Next id: 7
6489message BeginImplFrameArgs {
6490  optional int64 updated_at_us = 1;
6491  optional int64 finished_at_us = 2;
6492  enum State {
6493    BEGIN_FRAME_FINISHED = 0;
6494    BEGIN_FRAME_USING = 1;
6495  }
6496  optional State state = 3;
6497  oneof args {
6498    // Only set if |state| is BEGIN_FRAME_FINISHED.
6499    BeginFrameArgs current_args = 4;
6500    // Only set if |state| is BEGIN_FRAME_USING.
6501    BeginFrameArgs last_args = 5;
6502  }
6503  message TimestampsInUs {
6504    optional int64 interval_delta = 1;
6505    optional int64 now_to_deadline_delta = 2;
6506    optional int64 frame_time_to_now_delta = 3;
6507    optional int64 frame_time_to_deadline_delta = 4;
6508    optional int64 now = 5;
6509    optional int64 frame_time = 6;
6510    optional int64 deadline = 7;
6511  }
6512  optional TimestampsInUs timestamps_in_us = 6;
6513}
6514
6515message BeginFrameObserverState {
6516  optional int64 dropped_begin_frame_args = 1;
6517  optional BeginFrameArgs last_begin_frame_args = 2;
6518}
6519
6520message BeginFrameSourceState {
6521  optional uint32 source_id = 1;
6522  optional bool paused = 2;
6523  optional uint32 num_observers = 3;
6524  optional BeginFrameArgs last_begin_frame_args = 4;
6525}
6526
6527message CompositorTimingHistory {
6528  optional int64 begin_main_frame_queue_critical_estimate_delta_us = 1;
6529  optional int64 begin_main_frame_queue_not_critical_estimate_delta_us = 2;
6530  optional int64 begin_main_frame_start_to_ready_to_commit_estimate_delta_us =
6531      3;
6532  optional int64 commit_to_ready_to_activate_estimate_delta_us = 4;
6533  optional int64 prepare_tiles_estimate_delta_us = 5;
6534  optional int64 activate_estimate_delta_us = 6;
6535  optional int64 draw_estimate_delta_us = 7;
6536}
6537
6538// End of protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.proto
6539
6540// Begin of protos/perfetto/trace/track_event/chrome_content_settings_event_info.proto
6541
6542// Details about ContentSettings trace events.
6543message ChromeContentSettingsEventInfo {
6544  // The number of user defined hostname patterns for content settings at
6545  // browser start. Similar to UMA histogram
6546  // 'ContentSettings.NumberOfExceptions'.
6547  optional uint32 number_of_exceptions = 1;
6548}
6549// End of protos/perfetto/trace/track_event/chrome_content_settings_event_info.proto
6550
6551// Begin of protos/perfetto/trace/track_event/chrome_frame_reporter.proto
6552
6553message ChromeFrameReporter {
6554  enum State {
6555    // The frame did not have any updates to present.
6556    STATE_NO_UPDATE_DESIRED = 0;
6557
6558    // The frame presented all the desired updates (i.e. any updates requested
6559    // from both the compositor thread and main-threads were handled).
6560    STATE_PRESENTED_ALL = 1;
6561
6562    // The frame was presented with some updates, but also missed some updates
6563    // (e.g. missed updates from the main-thread, but included updates from the
6564    // compositor thread).
6565    STATE_PRESENTED_PARTIAL = 2;
6566
6567    // The frame was dropped, i.e. some updates were desired for the frame, but
6568    // was not presented.
6569    STATE_DROPPED = 3;
6570  };
6571
6572  optional State state = 1;
6573
6574  enum FrameDropReason {
6575    REASON_UNSPECIFIED = 0;
6576
6577    // Frame was dropped by the display-compositor.
6578    // The display-compositor may drop a frame some times (e.g. the frame missed
6579    // the deadline, or was blocked on surface-sync, etc.)
6580    REASON_DISPLAY_COMPOSITOR = 1;
6581
6582    // Frame was dropped because of the main-thread.
6583    // The main-thread may cause a frame to be dropped, e.g. if the main-thread
6584    // is running expensive javascript, or doing a lot of layout updates, etc.
6585    REASON_MAIN_THREAD = 2;
6586
6587    // Frame was dropped by the client compositor.
6588    // The client compositor can drop some frames too (e.g. attempting to
6589    // recover latency, missing the deadline, etc.).
6590    REASON_CLIENT_COMPOSITOR = 3;
6591  };
6592
6593  // The reason is set only if |state| is not |STATE_UPDATED_ALL|.
6594  optional FrameDropReason reason = 2;
6595
6596  optional uint64 frame_source = 3;
6597  optional uint64 frame_sequence = 4;
6598
6599  // If this is a droped frame (i.e. if |state| is set to |STATE_DROPPED| or
6600  // |STATE_PRESENTED_PARTIAL|), then indicates whether this frame impacts
6601  // smoothness.
6602  optional bool affects_smoothness = 5;
6603
6604  enum ScrollState {
6605    SCROLL_NONE = 0;
6606    SCROLL_MAIN_THREAD = 1;
6607    SCROLL_COMPOSITOR_THREAD = 2;
6608
6609    // Used when it can't be determined wheter a scroll is in progress or not.
6610    SCROLL_UNKNOWN = 3;
6611  }
6612
6613  // The type of active scroll
6614  optional ScrollState scroll_state = 6;
6615
6616  // If any main thread animation is active during this frame.
6617  optional bool has_main_animation = 7;
6618  // If any compositor thread animation is active during this frame.
6619  optional bool has_compositor_animation = 8;
6620  // If any touch-driven UX (not scroll) is active during this frame.
6621  optional bool has_smooth_input_main = 9;
6622
6623  // Whether the frame contained any missing content (i.e. whether there was
6624  // checkerboarding in the frame).
6625  optional bool has_missing_content = 10;
6626
6627  // The id of layer_tree_host that the frame has been produced for.
6628  optional uint64 layer_tree_host_id = 11;
6629}
6630
6631// End of protos/perfetto/trace/track_event/chrome_frame_reporter.proto
6632
6633// Begin of protos/perfetto/trace/track_event/chrome_keyed_service.proto
6634
6635// Details about one of Chrome's keyed services associated with the event.
6636message ChromeKeyedService {
6637  // Name of the service, e.g. "MediaRouter", "PreviewsService", etc. (in
6638  // Chrome, these are static strings known at compile time).
6639  optional string name = 1;
6640}
6641
6642// End of protos/perfetto/trace/track_event/chrome_keyed_service.proto
6643
6644// Begin of protos/perfetto/trace/track_event/chrome_latency_info.proto
6645
6646message ChromeLatencyInfo {
6647  optional int64 trace_id = 1;
6648
6649  // NEXT ID: 12
6650  // All step are optional but the enum is ordered (not by number) below in the
6651  // order we expect them to appear if they are emitted in trace in a blocking
6652  // fashion.
6653  enum Step {
6654    STEP_UNSPECIFIED = 0;
6655    // Emitted on the browser main thread.
6656    STEP_SEND_INPUT_EVENT_UI = 3;
6657    // Happens on the renderer's compositor.
6658    STEP_HANDLE_INPUT_EVENT_IMPL = 5;
6659    STEP_DID_HANDLE_INPUT_AND_OVERSCROLL = 8;
6660    // Occurs on the Renderer's main thread.
6661    STEP_HANDLE_INPUT_EVENT_MAIN = 4;
6662    STEP_MAIN_THREAD_SCROLL_UPDATE = 2;
6663    STEP_HANDLE_INPUT_EVENT_MAIN_COMMIT = 1;
6664    // Could be emitted on both the renderer's main OR compositor.
6665    STEP_HANDLED_INPUT_EVENT_MAIN_OR_IMPL = 9;
6666    // Optionally sometimes HANDLED_INPUT_EVENT_MAIN_OR_IMPL will proxy to the
6667    // renderer's compositor and this will be emitted.
6668    STEP_HANDLED_INPUT_EVENT_IMPL = 10;
6669    // Renderer's compositor.
6670    STEP_SWAP_BUFFERS = 6;
6671    // Happens on the VizCompositor in the GPU process.
6672    STEP_DRAW_AND_SWAP = 7;
6673    // Happens on the GPU main thread after the swap has completed.
6674    STEP_FINISHED_SWAP_BUFFERS = 11;
6675    // See above for NEXT ID, enum steps are not ordered by tag number.
6676  };
6677
6678  optional Step step = 2;
6679  optional int32 frame_tree_node_id = 3;
6680
6681  // This enum is a copy of LatencyComponentType enum in Chrome, located in
6682  // ui/latency/latency_info.h, modulo added UNKNOWN value per protobuf
6683  // practices.
6684  enum LatencyComponentType {
6685    COMPONENT_UNSPECIFIED = 0;
6686    COMPONENT_INPUT_EVENT_LATENCY_BEGIN_RWH = 1;
6687    COMPONENT_INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL = 2;
6688    COMPONENT_INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL = 3;
6689    COMPONENT_INPUT_EVENT_LATENCY_ORIGINAL = 4;
6690    COMPONENT_INPUT_EVENT_LATENCY_UI = 5;
6691    COMPONENT_INPUT_EVENT_LATENCY_RENDERER_MAIN = 6;
6692    COMPONENT_INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN = 7;
6693    COMPONENT_INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL = 8;
6694    COMPONENT_INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT = 9;
6695    COMPONENT_INPUT_EVENT_LATENCY_ACK_RWH = 10;
6696    COMPONENT_INPUT_EVENT_LATENCY_RENDERER_SWAP = 11;
6697    COMPONENT_DISPLAY_COMPOSITOR_RECEIVED_FRAME = 12;
6698    COMPONENT_INPUT_EVENT_GPU_SWAP_BUFFER = 13;
6699    COMPONENT_INPUT_EVENT_LATENCY_FRAME_SWAP = 14;
6700  }
6701
6702  message ComponentInfo {
6703    optional LatencyComponentType component_type = 1;
6704
6705    // Microsecond timestamp in CLOCK_MONOTONIC domain
6706    optional uint64 time_us = 2;
6707  };
6708
6709  repeated ComponentInfo component_info = 4;
6710  optional bool is_coalesced = 5;
6711  optional int64 gesture_scroll_id = 6;
6712}
6713
6714// End of protos/perfetto/trace/track_event/chrome_latency_info.proto
6715
6716// Begin of protos/perfetto/trace/track_event/chrome_legacy_ipc.proto
6717
6718// Details about a legacy Chrome IPC message that is either sent by the event.
6719// TODO(eseckler): Also use this message on the receiving side?
6720message ChromeLegacyIpc {
6721  enum MessageClass {
6722    CLASS_UNSPECIFIED = 0;
6723    CLASS_AUTOMATION = 1;
6724    CLASS_FRAME = 2;
6725    CLASS_PAGE = 3;
6726    CLASS_VIEW = 4;
6727    CLASS_WIDGET = 5;
6728    CLASS_INPUT = 6;
6729    CLASS_TEST = 7;
6730    CLASS_WORKER = 8;
6731    CLASS_NACL = 9;
6732    CLASS_GPU_CHANNEL = 10;
6733    CLASS_MEDIA = 11;
6734    CLASS_PPAPI = 12;
6735    CLASS_CHROME = 13;
6736    CLASS_DRAG = 14;
6737    CLASS_PRINT = 15;
6738    CLASS_EXTENSION = 16;
6739    CLASS_TEXT_INPUT_CLIENT = 17;
6740    CLASS_BLINK_TEST = 18;
6741    CLASS_ACCESSIBILITY = 19;
6742    CLASS_PRERENDER = 20;
6743    CLASS_CHROMOTING = 21;
6744    CLASS_BROWSER_PLUGIN = 22;
6745    CLASS_ANDROID_WEB_VIEW = 23;
6746    CLASS_NACL_HOST = 24;
6747    CLASS_ENCRYPTED_MEDIA = 25;
6748    CLASS_CAST = 26;
6749    CLASS_GIN_JAVA_BRIDGE = 27;
6750    CLASS_CHROME_UTILITY_PRINTING = 28;
6751    CLASS_OZONE_GPU = 29;
6752    CLASS_WEB_TEST = 30;
6753    CLASS_NETWORK_HINTS = 31;
6754    CLASS_EXTENSIONS_GUEST_VIEW = 32;
6755    CLASS_GUEST_VIEW = 33;
6756    CLASS_MEDIA_PLAYER_DELEGATE = 34;
6757    CLASS_EXTENSION_WORKER = 35;
6758    CLASS_SUBRESOURCE_FILTER = 36;
6759    CLASS_UNFREEZABLE_FRAME = 37;
6760  }
6761
6762  // Corresponds to the message class type defined in Chrome's IPCMessageStart
6763  // enum, e.g. FrameMsgStart,
6764  optional MessageClass message_class = 1;
6765
6766  // Line number of the message definition. See Chrome's IPC_MESSAGE_ID and
6767  // IPC_MESSAGE_START macros.
6768  optional uint32 message_line = 2;
6769}
6770
6771// End of protos/perfetto/trace/track_event/chrome_legacy_ipc.proto
6772
6773// Begin of protos/perfetto/trace/track_event/chrome_message_pump.proto
6774
6775// Details about Chrome message pump events
6776message ChromeMessagePump {
6777  // True if there are sent messages in the queue.
6778  optional bool sent_messages_in_queue = 1;
6779  // Interned SourceLocation of IO handler that MessagePumpForIO is about to
6780  // invoke.
6781  optional uint64 io_handler_location_iid = 2;
6782}
6783
6784// End of protos/perfetto/trace/track_event/chrome_message_pump.proto
6785
6786// Begin of protos/perfetto/trace/track_event/chrome_mojo_event_info.proto
6787
6788// Contains information to identify mojo handling events. The trace events in
6789// mojo are common for all mojo interfaces and this information is used to
6790// identify who is the caller or callee.
6791message ChromeMojoEventInfo {
6792  // Contains the interface name or the file name of the creator of a mojo
6793  // handle watcher, recorded when an event if notified to the watcher. The code
6794  // that runs within the track event belongs to the interface.
6795  optional string watcher_notify_interface_tag = 1;
6796
6797  // The hash of the IPC message that is being handled.
6798  optional uint32 ipc_hash = 2;
6799
6800  // A static string representing the mojo interface name of the message that is
6801  // being handled.
6802  optional string mojo_interface_tag = 3;
6803}
6804
6805// End of protos/perfetto/trace/track_event/chrome_mojo_event_info.proto
6806
6807// Begin of protos/perfetto/trace/track_event/chrome_renderer_scheduler_state.proto
6808
6809// Describes the state of the RendererScheduler for a given Renderer Process.
6810
6811// RAIL Mode is an indication of the kind of work that a Renderer is currently
6812// performing which is in turn used to prioritise work accordingly.
6813// A fuller description of these modes can be found https://web.dev/rail/
6814enum ChromeRAILMode {
6815  RAIL_MODE_NONE = 0;
6816  RAIL_MODE_RESPONSE = 1;
6817  RAIL_MODE_ANIMATION = 2;
6818  RAIL_MODE_IDLE = 3;
6819  RAIL_MODE_LOAD = 4;
6820}
6821
6822// Next id: 2
6823message ChromeRendererSchedulerState {
6824  optional ChromeRAILMode rail_mode = 1;
6825}
6826
6827// End of protos/perfetto/trace/track_event/chrome_renderer_scheduler_state.proto
6828
6829// Begin of protos/perfetto/trace/track_event/chrome_user_event.proto
6830
6831// Details about a UI interaction initiated by the user, such as opening or
6832// closing a tab or a context menu.
6833message ChromeUserEvent {
6834  // Name of the action, e.g. "NewTab", "ShowBookmarkManager", etc. (in
6835  // Chrome, these are usually static strings known at compile time, or
6836  // concatenations of multiple such static strings).
6837  optional string action = 1;
6838
6839  // MD5 hash of the action string.
6840  optional uint64 action_hash = 2;
6841}
6842
6843// End of protos/perfetto/trace/track_event/chrome_user_event.proto
6844
6845// Begin of protos/perfetto/trace/track_event/chrome_window_handle_event_info.proto
6846
6847// Details about HWNDMessageHandler trace events.
6848message ChromeWindowHandleEventInfo {
6849  optional uint32 dpi = 1;
6850  optional uint32 message_id = 2;
6851  optional fixed64 hwnd_ptr = 3;
6852}
6853
6854// End of protos/perfetto/trace/track_event/chrome_window_handle_event_info.proto
6855
6856// Begin of protos/perfetto/trace/track_event/task_execution.proto
6857
6858// TrackEvent arguments describing the execution of a task.
6859message TaskExecution {
6860  // Source location that the task was posted from.
6861  // interned SourceLocation.
6862  optional uint64 posted_from_iid = 1;
6863}
6864// End of protos/perfetto/trace/track_event/task_execution.proto
6865
6866// Begin of protos/perfetto/trace/track_event/track_event.proto
6867
6868// NOTE: Full TrackEvent support in the client lib and chrome is WIP, thus these
6869// protos are still subject to change. Don't depend on them staying as they are.
6870
6871// Trace events emitted by client instrumentation library (TRACE_EVENT macros),
6872// which describe activity on a track, such as a thread or asynchronous event
6873// track. The track is specified using separate TrackDescriptor messages and
6874// referred to via the track's UUID.
6875//
6876// A simple TrackEvent packet specifies a timestamp, category, name and type:
6877// ```protobuf
6878//   trace_packet {
6879//     timestamp: 1000
6880//     track_event {
6881//       categories: ["my_cat"]
6882//       name: "my_event"
6883//       type: TYPE_INSTANT
6884//      }
6885//    }
6886// ```
6887//
6888// To associate an event with a custom track (e.g. a thread), the track is
6889// defined in a separate packet and referred to from the TrackEvent by its UUID:
6890// ```protobuf
6891//   trace_packet {
6892//     track_descriptor {
6893//       track_uuid: 1234
6894//       name: "my_track"
6895//
6896//       // Optionally, associate the track with a thread.
6897//       thread_descriptor {
6898//         pid: 10
6899//         tid: 10
6900//         ..
6901//       }
6902//     }
6903//   }
6904// ```
6905//
6906// A pair of TYPE_SLICE_BEGIN and _END events form a slice on the track:
6907//
6908// ```protobuf
6909//   trace_packet {
6910//     timestamp: 1200
6911//     track_event {
6912//       track_uuid: 1234
6913//       categories: ["my_cat"]
6914//       name: "my_slice"
6915//       type: TYPE_SLICE_BEGIN
6916//     }
6917//   }
6918//   trace_packet {
6919//     timestamp: 1400
6920//     track_event {
6921//       track_uuid: 1234
6922//       type: TYPE_SLICE_END
6923//     }
6924//   }
6925// ```
6926// TrackEvents also support optimizations to reduce data repetition and encoded
6927// data size, e.g. through data interning (names, categories, ...) and delta
6928// encoding of timestamps/counters. For details, see the InternedData message.
6929// Further, default values for attributes of events on the same sequence (e.g.
6930// their default track association) can be emitted as part of a
6931// TrackEventDefaults message.
6932//
6933// Next reserved id: 13 (up to 15). Next id: 47.
6934message TrackEvent {
6935  // Names of categories of the event. In the client library, categories are a
6936  // way to turn groups of individual events on or off.
6937  // interned EventCategoryName.
6938  repeated uint64 category_iids = 3;
6939  // non-interned variant.
6940  repeated string categories = 22;
6941
6942  // Optional name of the event for its display in trace viewer. May be left
6943  // unspecified for events with typed arguments.
6944  //
6945  // Note that metrics should not rely on event names, as they are prone to
6946  // changing. Instead, they should use typed arguments to identify the events
6947  // they are interested in.
6948  oneof name_field {
6949    // interned EventName.
6950    uint64 name_iid = 10;
6951    // non-interned variant.
6952    string name = 23;
6953  }
6954
6955  // TODO(eseckler): Support using binary symbols for category/event names.
6956
6957  // Type of the TrackEvent (required if |phase| in LegacyEvent is not set).
6958  enum Type {
6959    TYPE_UNSPECIFIED = 0;
6960
6961    // Slice events are events that have a begin and end timestamp, i.e. a
6962    // duration. They can be nested similar to a callstack: If, on the same
6963    // track, event B begins after event A, but before A ends, B is a child
6964    // event of A and will be drawn as a nested event underneath A in the UI.
6965    // Note that child events should always end before their parents (e.g. B
6966    // before A).
6967    //
6968    // Each slice event is formed by a pair of BEGIN + END events. The END event
6969    // does not need to repeat any TrackEvent fields it has in common with its
6970    // corresponding BEGIN event. Arguments and debug annotations of the BEGIN +
6971    // END pair will be merged during trace import.
6972    //
6973    // Note that we deliberately chose not to support COMPLETE events (which
6974    // would specify a duration directly) since clients would need to delay
6975    // writing them until the slice is completed, which can result in reordered
6976    // events in the trace and loss of unfinished events at the end of a trace.
6977    TYPE_SLICE_BEGIN = 1;
6978    TYPE_SLICE_END = 2;
6979
6980    // Instant events are nestable events without duration. They can be children
6981    // of slice events on the same track.
6982    TYPE_INSTANT = 3;
6983
6984    // Event that provides a value for a counter track. |track_uuid| should
6985    // refer to a counter track and |counter_value| set to the new value. Note
6986    // that most other TrackEvent fields (e.g. categories, name, ..) are not
6987    // supported for TYPE_COUNTER events. See also CounterDescriptor.
6988    TYPE_COUNTER = 4;
6989  }
6990  optional Type type = 9;
6991
6992  // Identifies the track of the event. The default value may be overridden
6993  // using TrackEventDefaults, e.g., to specify the track of the TraceWriter's
6994  // sequence (in most cases sequence = one thread). If no value is specified
6995  // here or in TrackEventDefaults, the TrackEvent will be associated with an
6996  // implicit trace-global track (uuid 0). See TrackDescriptor::uuid.
6997  optional uint64 track_uuid = 11;
6998
6999  // A new value for a counter track. |track_uuid| should refer to a track with
7000  // a CounterDescriptor, and |type| should be TYPE_COUNTER. For a more
7001  // efficient encoding of counter values that are sampled at the beginning/end
7002  // of a slice, see |extra_counter_values| and |extra_counter_track_uuids|.
7003  // Counter values can optionally be encoded in as delta values (positive or
7004  // negative) on each packet sequence (see CounterIncrementalBase).
7005  oneof counter_value_field {
7006    int64 counter_value = 30;
7007    double double_counter_value = 44;
7008  }
7009
7010  // To encode counter values more efficiently, we support attaching additional
7011  // counter values to a TrackEvent of any type. All values will share the same
7012  // timestamp specified in the TracePacket. The value at
7013  // extra_counter_values[N] is for the counter track referenced by
7014  // extra_counter_track_uuids[N].
7015  //
7016  // |extra_counter_track_uuids| may also be set via TrackEventDefaults. There
7017  // should always be equal or more uuids than values. It is valid to set more
7018  // uuids (e.g. via defaults) than values. If uuids are specified in
7019  // TrackEventDefaults and a TrackEvent, the TrackEvent uuids override the
7020  // default uuid list.
7021  //
7022  // For example, this allows snapshotting the thread time clock at each
7023  // thread-track BEGIN and END event to capture the cpu time delta of a slice.
7024  repeated uint64 extra_counter_track_uuids = 31;
7025  repeated int64 extra_counter_values = 12;
7026
7027  // Counter snapshots using floating point instead of integer values.
7028  repeated uint64 extra_double_counter_track_uuids = 45;
7029  repeated double extra_double_counter_values = 46;
7030
7031  // IDs of flows originating, passing through, or ending at this event.
7032  // Flow IDs are global within a trace.
7033  //
7034  // A flow connects a sequence of TrackEvents within or across tracks, e.g.
7035  // an input event may be handled on one thread but cause another event on
7036  // a different thread - a flow between the two events can associate them.
7037  //
7038  // The direction of the flows between events is inferred from the events'
7039  // timestamps. The earliest event with the same flow ID becomes the source
7040  // of the flow. Any events thereafter are intermediate steps of the flow,
7041  // until the flow terminates at the last event with the flow ID.
7042  //
7043  // Flows can also be explicitly terminated (see |terminating_flow_ids|), so
7044  // that the same ID can later be reused for another flow.
7045  repeated uint64 flow_ids = 36;
7046
7047  // List of flow ids which should terminate on this event, otherwise same as
7048  // |flow_ids|.
7049  // Any one flow ID should be either listed as part of |flow_ids| OR
7050  // |terminating_flow_ids|, not both.
7051  repeated uint64 terminating_flow_ids = 42;
7052
7053  // ---------------------------------------------------------------------------
7054  // TrackEvent arguments:
7055  // ---------------------------------------------------------------------------
7056
7057  // Unstable key/value annotations shown in the trace viewer but not intended
7058  // for metrics use.
7059  repeated DebugAnnotation debug_annotations = 4;
7060
7061  // Typed event arguments:
7062  optional TaskExecution task_execution = 5;
7063  optional LogMessage log_message = 21;
7064  optional ChromeCompositorSchedulerState cc_scheduler_state = 24;
7065  optional ChromeUserEvent chrome_user_event = 25;
7066  optional ChromeKeyedService chrome_keyed_service = 26;
7067  optional ChromeLegacyIpc chrome_legacy_ipc = 27;
7068  optional ChromeHistogramSample chrome_histogram_sample = 28;
7069  optional ChromeLatencyInfo chrome_latency_info = 29;
7070  optional ChromeFrameReporter chrome_frame_reporter = 32;
7071  optional ChromeApplicationStateInfo chrome_application_state_info = 39;
7072  optional ChromeRendererSchedulerState chrome_renderer_scheduler_state = 40;
7073  optional ChromeWindowHandleEventInfo chrome_window_handle_event_info = 41;
7074  optional ChromeContentSettingsEventInfo chrome_content_settings_event_info =
7075      43;
7076
7077  // This field is used only if the source location represents the function that
7078  // executes during this event.
7079  oneof source_location_field {
7080    // Non-interned field.
7081    SourceLocation source_location = 33;
7082    // Interned field.
7083    uint64 source_location_iid = 34;
7084  }
7085
7086  optional ChromeMessagePump chrome_message_pump = 35;
7087  optional ChromeMojoEventInfo chrome_mojo_event_info = 38;
7088
7089  // New argument types go here :)
7090
7091  // Extension range for typed events defined externally.
7092  // See docs/design-docs/extensions.md for more details.
7093  //
7094  // Extension support is work-in-progress, in the future the way to reserve a
7095  // subrange for a particular project will be described here and in the design
7096  // document linked above.
7097  //
7098  // Contact perfetto-dev@googlegroups.com if you are interested in a subrange
7099  // for your project.
7100
7101  // Extension range for future use.
7102  extensions 1000 to 9899;
7103  // Reserved for Perfetto unit and integration tests.
7104  extensions 9900 to 10000;
7105
7106  // ---------------------------------------------------------------------------
7107  // Deprecated / legacy event fields, which will be removed in the future:
7108  // ---------------------------------------------------------------------------
7109
7110  // Deprecated. Use the |timestamp| and |timestamp_clock_id| fields in
7111  // TracePacket instead.
7112  //
7113  // Timestamp in microseconds (usually CLOCK_MONOTONIC).
7114  oneof timestamp {
7115    // Delta timestamp value since the last TrackEvent or ThreadDescriptor. To
7116    // calculate the absolute timestamp value, sum up all delta values of the
7117    // preceding TrackEvents since the last ThreadDescriptor and add the sum to
7118    // the |reference_timestamp| in ThreadDescriptor. This value should always
7119    // be positive.
7120    int64 timestamp_delta_us = 1;
7121    // Absolute value (e.g. a manually specified timestamp in the macro).
7122    // This is a one-off value that does not affect delta timestamp computation
7123    // in subsequent TrackEvents.
7124    int64 timestamp_absolute_us = 16;
7125  }
7126
7127  // Deprecated. Use |extra_counter_values| and |extra_counter_track_uuids| to
7128  // encode thread time instead.
7129  //
7130  // CPU time for the current thread (e.g., CLOCK_THREAD_CPUTIME_ID) in
7131  // microseconds.
7132  oneof thread_time {
7133    // Delta timestamp value since the last TrackEvent or ThreadDescriptor. To
7134    // calculate the absolute timestamp value, sum up all delta values of the
7135    // preceding TrackEvents since the last ThreadDescriptor and add the sum to
7136    // the |reference_timestamp| in ThreadDescriptor. This value should always
7137    // be positive.
7138    int64 thread_time_delta_us = 2;
7139    // This is a one-off absolute value that does not affect delta timestamp
7140    // computation in subsequent TrackEvents.
7141    int64 thread_time_absolute_us = 17;
7142  }
7143
7144  // Deprecated. Use |extra_counter_values| and |extra_counter_track_uuids| to
7145  // encode thread instruction count instead.
7146  //
7147  // Value of the instruction counter for the current thread.
7148  oneof thread_instruction_count {
7149    // Same encoding as |thread_time| field above.
7150    int64 thread_instruction_count_delta = 8;
7151    int64 thread_instruction_count_absolute = 20;
7152  }
7153
7154  // Apart from {category, time, thread time, tid, pid}, other legacy trace
7155  // event attributes are initially simply proxied for conversion to a JSON
7156  // trace. We intend to gradually transition these attributes to similar native
7157  // features in TrackEvent (e.g. async + flow events), or deprecate them
7158  // without replacement where transition is unsuitable.
7159  //
7160  // Next reserved id: 16 (up to 16).
7161  // Next id: 20.
7162  message LegacyEvent {
7163    // Deprecated, use TrackEvent::name(_iid) instead.
7164    // interned EventName.
7165    optional uint64 name_iid = 1;
7166    optional int32 phase = 2;
7167    optional int64 duration_us = 3;
7168    optional int64 thread_duration_us = 4;
7169
7170    // Elapsed retired instruction count during the event.
7171    optional int64 thread_instruction_delta = 15;
7172
7173    // used to be |flags|.
7174    reserved 5;
7175
7176    oneof id {
7177      uint64 unscoped_id = 6;
7178      uint64 local_id = 10;
7179      uint64 global_id = 11;
7180    }
7181    // Additional optional scope for |id|.
7182    optional string id_scope = 7;
7183
7184    // Consider the thread timestamps for async BEGIN/END event pairs as valid.
7185    optional bool use_async_tts = 9;
7186
7187    // Idenfifies a flow. Flow events with the same bind_id are connected.
7188    optional uint64 bind_id = 8;
7189    // Use the enclosing slice as binding point for a flow end event instead of
7190    // the next slice. Flow start/step events always bind to the enclosing
7191    // slice.
7192    optional bool bind_to_enclosing = 12;
7193
7194    enum FlowDirection {
7195      FLOW_UNSPECIFIED = 0;
7196      FLOW_IN = 1;
7197      FLOW_OUT = 2;
7198      FLOW_INOUT = 3;
7199    }
7200    optional FlowDirection flow_direction = 13;
7201
7202    enum InstantEventScope {
7203      SCOPE_UNSPECIFIED = 0;
7204      SCOPE_GLOBAL = 1;
7205      SCOPE_PROCESS = 2;
7206      SCOPE_THREAD = 3;
7207    }
7208    optional InstantEventScope instant_event_scope = 14;
7209
7210    // Override the pid/tid if the writer needs to emit events on behalf of
7211    // another process/thread. This should be the exception. Normally, the
7212    // pid+tid from ThreadDescriptor is used.
7213    optional int32 pid_override = 18;
7214    optional int32 tid_override = 19;
7215  }
7216
7217  optional LegacyEvent legacy_event = 6;
7218}
7219
7220// Default values for fields of all TrackEvents on the same packet sequence.
7221// Should be emitted as part of TracePacketDefaults whenever incremental state
7222// is cleared. It's defined here because field IDs should match those of the
7223// corresponding fields in TrackEvent.
7224message TrackEventDefaults {
7225  optional uint64 track_uuid = 11;
7226  repeated uint64 extra_counter_track_uuids = 31;
7227  repeated uint64 extra_double_counter_track_uuids = 45;
7228
7229  // TODO(eseckler): Support default values for more TrackEvent fields.
7230}
7231
7232// --------------------
7233// Interned data types:
7234// --------------------
7235
7236message EventCategory {
7237  optional uint64 iid = 1;
7238  optional string name = 2;
7239}
7240
7241message EventName {
7242  optional uint64 iid = 1;
7243  optional string name = 2;
7244}
7245
7246// End of protos/perfetto/trace/track_event/track_event.proto
7247
7248// Begin of protos/perfetto/trace/interned_data/interned_data.proto
7249
7250// ------------------------------ DATA INTERNING: ------------------------------
7251// Interning indexes are built up gradually by adding the entries contained in
7252// each TracePacket of the same packet sequence (packets emitted by the same
7253// producer and TraceWriter, see |trusted_packet_sequence_id|). Thus, packets
7254// can only refer to interned data from other packets in the same sequence.
7255//
7256// The writer will emit new entries when it encounters new internable values
7257// that aren't yet in the index. Data in current and subsequent TracePackets can
7258// then refer to the entry by its position (interning ID, abbreviated "iid") in
7259// its index. An interning ID with value 0 is considered invalid (not set).
7260//
7261// Because of the incremental build-up, the interning index will miss data when
7262// TracePackets are lost, e.g. because a chunk was overridden in the central
7263// ring buffer. To avoid invalidation of the whole trace in such a case, the
7264// index is periodically reset (see SEQ_INCREMENTAL_STATE_CLEARED).
7265// When packet loss occurs, the reader will only lose interning data up to the
7266// next reset.
7267// -----------------------------------------------------------------------------
7268
7269// Message that contains new entries for the interning indices of a packet
7270// sequence.
7271//
7272// The writer will usually emit new entries in the same TracePacket that first
7273// refers to them (since the last reset of interning state). They may also be
7274// emitted proactively in advance of referring to them in later packets.
7275//
7276// Next reserved id: 8 (up to 15).
7277// Next id: 27.
7278message InternedData {
7279  // TODO(eseckler): Replace iid fields inside interned messages with
7280  // map<iid, message> type fields in InternedData.
7281
7282  // Each field's message type needs to specify an |iid| field, which is the ID
7283  // of the entry in the field's interning index. Each field constructs its own
7284  // index, thus interning IDs are scoped to the tracing session and field
7285  // (usually as a counter for efficient var-int encoding). It is illegal to
7286  // override entries in an index (using the same iid for two different values)
7287  // within the same tracing session, even after a reset of the emitted
7288  // interning state.
7289  repeated EventCategory event_categories = 1;
7290  repeated EventName event_names = 2;
7291  repeated DebugAnnotationName debug_annotation_names = 3;
7292  repeated SourceLocation source_locations = 4;
7293  repeated LogMessageBody log_message_body = 20;
7294  repeated HistogramName histogram_names = 25;
7295
7296  // Note: field IDs up to 15 should be used for frequent data only.
7297
7298  // Build IDs of exectuable files.
7299  repeated InternedString build_ids = 16;
7300  // Paths to executable files.
7301  repeated InternedString mapping_paths = 17;
7302  // Paths to source files.
7303  repeated InternedString source_paths = 18;
7304  // Names of functions used in frames below.
7305  repeated InternedString function_names = 5;
7306  // Symbols that were added to this trace after the fact.
7307  repeated ProfiledFrameSymbols profiled_frame_symbols = 21;
7308
7309  // Executable files mapped into processes.
7310  repeated Mapping mappings = 19;
7311  // Frames of callstacks of a program.
7312  repeated Frame frames = 6;
7313  // A callstack of a program.
7314  repeated Callstack callstacks = 7;
7315
7316  // Additional Vulkan information sent in a VulkanMemoryEvent message
7317  repeated InternedString vulkan_memory_keys = 22;
7318
7319  // Graphics context of a render stage event.  This represent the GL
7320  // context for an OpenGl app or the VkDevice for a Vulkan app.
7321  repeated InternedGraphicsContext graphics_contexts = 23;
7322
7323  // Description of a GPU hardware queue or render stage.
7324  repeated InternedGpuRenderStageSpecification gpu_specifications = 24;
7325
7326  // This is set when FtraceConfig.symbolize_ksyms = true.
7327  // The id of each symbol the number that will be reported in ftrace events
7328  // like sched_block_reason.caller and is obtained from a monotonic counter.
7329  // The same symbol can have different indexes in different bundles.
7330  // This is is NOT the real address. This is to avoid disclosing KASLR through
7331  // traces.
7332  repeated InternedString kernel_symbols = 26;
7333}
7334
7335// End of protos/perfetto/trace/interned_data/interned_data.proto
7336
7337// Begin of protos/perfetto/trace/memory_graph.proto
7338
7339// Message definitions for app-reported memory breakdowns. At the moment, this
7340// is a Chrome-only tracing feature, historically known as 'memory-infra'. See
7341// https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/ .
7342// This is unrelated to the native or java heap profilers (those protos live
7343// in //protos/perfetto/trace/profiling/).
7344
7345message MemoryTrackerSnapshot {
7346  // Memory snapshot of a process. The snapshot contains memory data that is
7347  // from 2 different sources, namely system stats and instrumentation stats.
7348  // The system memory usage stats come from the OS based on standard API
7349  // available in the platform to query memory usage. The instrumentation stats
7350  // are added by instrumenting specific piece of code which tracks memory
7351  // allocations and deallocations made by a small sub-system within the
7352  // application.
7353  // The system stats of the global memory snapshot are recorded as part of
7354  // ProcessStats and SmapsPacket fields in trace packet with the same
7355  // timestamp.
7356  message ProcessSnapshot {
7357    // Process ID of the process
7358    optional int32 pid = 1;
7359
7360    // Memory dumps are represented as a graph of memory nodes which contain
7361    // statistics. To avoid double counting the same memory across different
7362    // nodes, edges are used to mark nodes that account for the same memory. See
7363    // this doc for examples of the usage:
7364    // https://docs.google.com/document/d/1WGQRJ1sjJrfVkNcgPVY6frm64UqPc94tsxUOXImZUZI
7365
7366    // A single node in the memory graph.
7367    message MemoryNode {
7368      // Unique ID of the node across all processes involved in the global
7369      // memory dump. The ID is only unique within this particular global dump
7370      // identified by GlobalMemoryDumpPacket.global_dump_id.
7371      optional uint64 id = 1;
7372
7373      // Absolute name is a unique name for the memory node within the process
7374      // with ProcessMemoryDump.pid. The name can contain multiple parts
7375      // separated by '/', which traces the edges of the node from the root
7376      // node.
7377      // Eg: "partition_allocator/array_buffers/buffer1" refers to the child
7378      // node "buffer1" in a graph structure of:
7379      //   root -> partition_allocator -> array_buffers -> buffer1.
7380      optional string absolute_name = 2;
7381
7382      // A weak node means that the instrumentation that added the current node
7383      // is unsure about the existence of the actual memory. Unless a "strong"
7384      // (non-weak is default) node that has an edge to the current node exists
7385      // in the current global dump, the current node will be discarded.
7386      optional bool weak = 3;
7387
7388      // Size of the node in bytes, used to compute the effective size of the
7389      // nodes without double counting.
7390      optional uint64 size_bytes = 4;
7391
7392      // Entries in the memory node that contain statistics and additional
7393      // debuggable information about the memory. The size of the node is
7394      // tracked separately in the |size_bytes| field.
7395      message MemoryNodeEntry {
7396        optional string name = 1;
7397
7398        enum Units {
7399          UNSPECIFIED = 0;
7400          BYTES = 1;
7401          COUNT = 2;
7402        }
7403        optional Units units = 2;
7404
7405        // Contains either one of uint64 or string value.
7406        optional uint64 value_uint64 = 3;
7407        optional string value_string = 4;
7408      }
7409      repeated MemoryNodeEntry entries = 5;
7410    }
7411    repeated MemoryNode allocator_dumps = 2;
7412
7413    // A directed edge that connects any 2 nodes in the graph above. These are
7414    // in addition to the inherent edges added due to the tree structure of the
7415    // node's absolute names.
7416    // Node with id |source_id| owns the node with id |target_id|, and has the
7417    // effect of attributing the memory usage of target to source. |importance|
7418    // is optional and relevant only for the cases of co-ownership, where it
7419    // acts as a z-index: the owner with the highest importance will be
7420    // attributed target's memory.
7421    message MemoryEdge {
7422      optional uint64 source_id = 1;
7423      optional uint64 target_id = 2;
7424      optional uint32 importance = 3;
7425      optional bool overridable = 4;
7426    }
7427    repeated MemoryEdge memory_edges = 3;
7428  }
7429
7430  // Unique ID that represents the global memory dump.
7431  optional uint64 global_dump_id = 1;
7432
7433  enum LevelOfDetail {
7434    DETAIL_FULL = 0;
7435    DETAIL_LIGHT = 1;
7436    DETAIL_BACKGROUND = 2;
7437  }
7438  optional LevelOfDetail level_of_detail = 2;
7439
7440  repeated ProcessSnapshot process_memory_dumps = 3;
7441}
7442
7443// End of protos/perfetto/trace/memory_graph.proto
7444
7445// Begin of protos/perfetto/trace/perfetto/perfetto_metatrace.proto
7446
7447// Used to trace the execution of perfetto itself.
7448message PerfettoMetatrace {
7449  // See base/metatrace_events.h for definitions.
7450  oneof record_type {
7451    uint32 event_id = 1;
7452    uint32 counter_id = 2;
7453
7454    // For trace processor metatracing.
7455    string event_name = 8;
7456    string counter_name = 9;
7457  }
7458  message Arg {
7459    optional string key = 1;
7460    optional string value = 2;
7461  }
7462
7463  // Only when using |event_id|.
7464  optional uint32 event_duration_ns = 3;
7465
7466  // Only when using |counter_id|.
7467  optional int32 counter_value = 4;
7468
7469  // ID of the thread that emitted the event.
7470  optional uint32 thread_id = 5;
7471
7472  // If true the meta-tracing ring buffer had overruns and hence some data is
7473  // missing from this point.
7474  optional bool has_overruns = 6;
7475
7476  // Args for the event.
7477  repeated Arg args = 7;
7478}
7479
7480// End of protos/perfetto/trace/perfetto/perfetto_metatrace.proto
7481
7482// Begin of protos/perfetto/trace/perfetto/tracing_service_event.proto
7483
7484// Events emitted by the tracing service.
7485message TracingServiceEvent {
7486  oneof event_type {
7487    // When each of the following booleans are set to true, they report the
7488    // point in time (through TracePacket's timestamp) where the condition
7489    // they describe happened.
7490    // The order of the booleans below matches the timestamp ordering
7491    // they would generally be expected to have.
7492
7493    // Emitted when we start tracing and specifically, this will be before any
7494    // producer is notified about the existence of this trace. This is always
7495    // emitted before the all_data_sources_started event. This event is also
7496    // guaranteed to be seen (byte-offset wise) before any data packets from
7497    // producers.
7498    bool tracing_started = 2;
7499
7500    // Emitted after all data sources saw the start event and ACKed it.
7501    // This identifies the point in time when it's safe to assume that all data
7502    // sources have been recording events.
7503    bool all_data_sources_started = 1;
7504
7505    // Emitted when all data sources have been flushed successfully or with an
7506    // error (including timeouts). This can generally happen many times over the
7507    // course of the trace.
7508    bool all_data_sources_flushed = 3;
7509
7510    // Emitted when reading back the central tracing buffers has been completed.
7511    // If |write_into_file| is specified, this can happen many times over the
7512    // course of the trace.
7513    bool read_tracing_buffers_completed = 4;
7514
7515    // Emitted after tracing has been disabled and specifically, this will be
7516    // after all packets from producers have been included in the central
7517    // tracing buffer.
7518    bool tracing_disabled = 5;
7519
7520    // Emitted if perfetto --save-for-bugreport was invoked while the current
7521    // tracing session was running and it had the highest bugreport_score. In
7522    // this case the original consumer will see a nearly empty trace, because
7523    // the contents are routed onto the bugreport file. This event flags the
7524    // situation explicitly. Traces that contain this marker should be discarded
7525    // by test infrastructures / pipelines.
7526    bool seized_for_bugreport = 6;
7527  }
7528}
7529
7530// End of protos/perfetto/trace/perfetto/tracing_service_event.proto
7531
7532// Begin of protos/perfetto/common/android_energy_consumer_descriptor.proto
7533
7534// Energy consumer based on aidl class:
7535// android.hardware.power.stats.EnergyConsumer.
7536message AndroidEnergyConsumer {
7537  // Unique ID of this energy consumer.  Matches the ID in a
7538  // AndroidEnergyEstimationBreakdown.
7539  optional int32 energy_consumer_id = 1;
7540
7541  // For a group of energy consumers of the same logical type, sorting by
7542  // ordinal gives their physical order. Ordinals must be consecutive integers
7543  // starting from 0.
7544  optional int32 ordinal = 2;
7545
7546  // Type of this energy consumer.
7547  optional string type = 3;
7548
7549  // Unique name of this energy consumer. Vendor/device specific. Opaque to
7550  // framework.
7551  optional string name = 4;
7552}
7553
7554message AndroidEnergyConsumerDescriptor {
7555  repeated AndroidEnergyConsumer energy_consumers = 1;
7556}
7557
7558// End of protos/perfetto/common/android_energy_consumer_descriptor.proto
7559
7560// Begin of protos/perfetto/trace/power/android_energy_estimation_breakdown.proto
7561
7562// Energy data retrieve using the ODPM(On Device Power Monitor) API.
7563// This proto represents the aidl class:
7564// android.hardware.power.stats.EnergyConsumerResult.
7565message AndroidEnergyEstimationBreakdown {
7566  // The first trace packet of each session should include a energy consumer
7567  // descriptor.
7568  optional AndroidEnergyConsumerDescriptor energy_consumer_descriptor = 1;
7569
7570  // ID of the AndroidEnergyConsumer associated with this result.  Matches
7571  // the energy_consumer_id in the AndroidEnergyConsumerDescriptor that
7572  // should be sent at the beginning of a trace.
7573  optional int32 energy_consumer_id = 2;
7574
7575  // Total accumulated energy since boot in microwatt-seconds (uWs)
7576  optional int64 energy_uws = 3;
7577
7578  message EnergyUidBreakdown {
7579    // Android ID/Linux UID, the accumulated energy is attributed to.
7580    optional int32 uid = 1;
7581
7582    // Accumulated energy since boot in microwatt-seconds (uWs).
7583    optional int64 energy_uws = 2;
7584  }
7585  // Optional attributed energy per Android ID / Linux UID for this
7586  // EnergyConsumer. Sum total of attributed energy must be less than or equal
7587  // to total accumulated energy.
7588  repeated EnergyUidBreakdown per_uid_breakdown = 4;
7589}
7590
7591// End of protos/perfetto/trace/power/android_energy_estimation_breakdown.proto
7592
7593// Begin of protos/perfetto/trace/power/battery_counters.proto
7594
7595message BatteryCounters {
7596  // Battery capacity in microampere-hours(µAh). Also known as Coulomb counter.
7597  optional int64 charge_counter_uah = 1;
7598
7599  // Remaining battery capacity percentage of total capacity
7600  optional float capacity_percent = 2;
7601
7602  // Instantaneous battery current in microamperes(µA).
7603  // Positive values indicate current drained from the battery,
7604  // negative values current feeding the battery from a charge source (USB).
7605  // See https://perfetto.dev/docs/data-sources/battery-counters for more.
7606  optional int64 current_ua = 3;
7607
7608  // Instantaneous battery current in microamperes(µA).
7609  optional int64 current_avg_ua = 4;
7610}
7611
7612// End of protos/perfetto/trace/power/battery_counters.proto
7613
7614// Begin of protos/perfetto/trace/power/power_rails.proto
7615
7616message PowerRails {
7617
7618  message RailDescriptor {
7619    // Index corresponding to the rail
7620    optional uint32 index = 1;
7621
7622    // Name of the rail
7623    optional string rail_name = 2;
7624
7625    // Name of the subsystem to which this rail belongs
7626    optional string subsys_name = 3;
7627
7628    // Hardware sampling rate (Hz).
7629    optional uint32 sampling_rate = 4;
7630  }
7631
7632  // This is only emitted at the beginning of the trace.
7633  repeated RailDescriptor rail_descriptor = 1;
7634
7635  message EnergyData {
7636    // Index corresponding to RailDescriptor.index
7637    optional uint32 index = 1;
7638
7639    // Time since device boot(CLOCK_BOOTTIME) in milli-seconds.
7640    optional uint64 timestamp_ms = 2;
7641
7642    // Accumulated energy since device boot in microwatt-seconds (uWs).
7643    optional uint64 energy = 3;
7644  }
7645
7646  repeated EnergyData energy_data = 2;
7647}
7648
7649// End of protos/perfetto/trace/power/power_rails.proto
7650
7651// Begin of protos/perfetto/trace/profiling/deobfuscation.proto
7652
7653message ObfuscatedMember {
7654  // This is the obfuscated field name relative to the class containing the
7655  // ObfuscatedMember.
7656  optional string obfuscated_name = 1;
7657  // If this is fully qualified (i.e. contains a '.') this is the deobfuscated
7658  // field name including its class. Otherwise, this is this the unqualified
7659  // deobfuscated field name relative to the class containing this
7660  // ObfuscatedMember.
7661  optional string deobfuscated_name = 2;
7662}
7663
7664message ObfuscatedClass {
7665  optional string obfuscated_name = 1;
7666  optional string deobfuscated_name = 2;
7667  // fields.
7668  repeated ObfuscatedMember obfuscated_members = 3;
7669  repeated ObfuscatedMember obfuscated_methods = 4;
7670}
7671
7672message DeobfuscationMapping {
7673  optional string package_name = 1;
7674  optional int64 version_code = 2;
7675  repeated ObfuscatedClass obfuscated_classes = 3;
7676}
7677// End of protos/perfetto/trace/profiling/deobfuscation.proto
7678
7679// Begin of protos/perfetto/trace/profiling/heap_graph.proto
7680
7681message HeapGraphRoot {
7682  enum Type {
7683    ROOT_UNKNOWN = 0;
7684    ROOT_JNI_GLOBAL = 1;
7685    ROOT_JNI_LOCAL = 2;
7686    ROOT_JAVA_FRAME = 3;
7687    ROOT_NATIVE_STACK = 4;
7688    ROOT_STICKY_CLASS = 5;
7689    ROOT_THREAD_BLOCK = 6;
7690    ROOT_MONITOR_USED = 7;
7691    ROOT_THREAD_OBJECT = 8;
7692    ROOT_INTERNED_STRING = 9;
7693    ROOT_FINALIZING = 10;
7694    ROOT_DEBUGGER = 11;
7695    ROOT_REFERENCE_CLEANUP = 12;
7696    ROOT_VM_INTERNAL = 13;
7697    ROOT_JNI_MONITOR = 14;
7698  };
7699  // Objects retained by this root.
7700  repeated uint64 object_ids = 1 [packed = true];
7701
7702  optional Type root_type = 2;
7703}
7704
7705message HeapGraphType {
7706  enum Kind {
7707    KIND_UNKNOWN = 0;
7708    KIND_NORMAL = 1;
7709    KIND_NOREFERENCES = 2;
7710    KIND_STRING = 3;
7711    KIND_ARRAY = 4;
7712    KIND_CLASS = 5;
7713    KIND_CLASSLOADER = 6;
7714    KIND_DEXCACHE = 7;
7715    KIND_SOFT_REFERENCE = 8;
7716    KIND_WEAK_REFERENCE = 9;
7717    KIND_FINALIZER_REFERENCE = 10;
7718    KIND_PHANTOM_REFERENCE = 11;
7719  };
7720  // TODO(fmayer): Consider removing this and using the index in the repeaed
7721  // field to save space.
7722  optional uint64 id = 1;
7723  optional uint64 location_id = 2;
7724  optional string class_name = 3;
7725  // Size of objects of this type.
7726  optional uint64 object_size = 4;
7727  optional uint64 superclass_id = 5;
7728  // Indices for InternedData.field_names for the names of the fields of
7729  // instances of this class. This does NOT include the fields from
7730  // superclasses. The consumer of this data needs to walk all super
7731  // classes to get a full lists of fields. Objects always write the
7732  // fields in order of most specific class to the furthest up superclass.
7733  repeated uint64 reference_field_id = 6 [packed = true];
7734  optional Kind kind = 7;
7735  optional uint64 classloader_id = 8;
7736}
7737
7738message HeapGraphObject {
7739  oneof identifier {
7740    uint64 id = 1;
7741    uint64 id_delta = 7;
7742  }
7743
7744  // Index for InternedData.types for the name of the type of this object.
7745  optional uint64 type_id = 2;
7746
7747  // Bytes occupied by this objects.
7748  optional uint64 self_size = 3;
7749
7750  // Add this to all non-zero values in reference_field_id. This is used to
7751  // get more compact varint encoding.
7752  optional uint64 reference_field_id_base = 6;
7753
7754  // Indices for InternedData.field_names for the name of the field referring
7755  // to the object. For Android S+ and for instances of normal classes (e.g.
7756  // not instances of java.lang.Class or arrays), this is instead set in the
7757  // corresponding HeapGraphType, and this is left empty.
7758  repeated uint64 reference_field_id = 4 [packed = true];
7759
7760  // Ids of the Object that is referred to.
7761  repeated uint64 reference_object_id = 5 [packed = true];
7762}
7763
7764message HeapGraph {
7765  optional int32 pid = 1;
7766
7767  // This contains all objects at the time this dump was taken. Some of these
7768  // will be live, some of those unreachable (garbage). To find the live
7769  // objects, the client needs to build the transitive closure of objects
7770  // reachable from |roots|.
7771  // All objects not contained within that transitive closure are garbage that
7772  // has not yet been collected.
7773  repeated HeapGraphObject objects = 2;
7774
7775  // Roots at the time this dump was taken.
7776  // All live objects are reachable from the roots. All other objects are
7777  // garbage.
7778  repeated HeapGraphRoot roots = 7;
7779
7780  // Types used in HeapGraphObjects.
7781  repeated HeapGraphType types = 9;
7782
7783  reserved 3;
7784
7785  // Field names for references in managed heap graph.
7786  repeated InternedString field_names = 4;
7787
7788  // Paths of files used in managed heap graph.
7789  repeated InternedString location_names = 8;
7790
7791  optional bool continued = 5;
7792  optional uint64 index = 6;
7793}
7794
7795// End of protos/perfetto/trace/profiling/heap_graph.proto
7796
7797// Begin of protos/perfetto/trace/profiling/profile_packet.proto
7798
7799message ProfilePacket {
7800  // The following interning tables are only used in Android version Q.
7801  // In newer versions, these tables are in InternedData
7802  // (see protos/perfetto/trace/interned_data) and are shared across
7803  // multiple ProfilePackets.
7804  // For backwards compatibility, consumers need to first look up interned
7805  // data in the tables within the ProfilePacket, and then, if they are empty,
7806  // look up in the InternedData instead.
7807  repeated InternedString strings = 1;
7808  repeated Mapping mappings = 4;
7809  repeated Frame frames = 2;
7810  repeated Callstack callstacks = 3;
7811
7812  // Next ID: 9
7813  message HeapSample {
7814    optional uint64 callstack_id = 1;
7815    // bytes allocated at this callstack.
7816    optional uint64 self_allocated = 2;
7817    // bytes allocated at this callstack that have been freed.
7818    optional uint64 self_freed = 3;
7819    // deprecated self_idle.
7820    reserved 7;
7821    // Bytes allocated by this callstack but not freed at the time the malloc
7822    // heap usage of this process was maximal. This is only set if dump_at_max
7823    // is true in HeapprofdConfig. In that case, self_allocated, self_freed and
7824    // self_idle will not be set.
7825    optional uint64 self_max = 8;
7826    // Number of allocations that were sampled at this callstack but not freed
7827    // at the time the malloc heap usage of this process was maximal. This is
7828    // only set if dump_at_max is true in HeapprofdConfig. In that case,
7829    // self_allocated, self_freed and self_idle will not be set.
7830    optional uint64 self_max_count = 9;
7831    // timestamp [opt]
7832    optional uint64 timestamp = 4;
7833    // Number of allocations that were sampled at this callstack.
7834    optional uint64 alloc_count = 5;
7835    // Number of allocations that were sampled at this callstack that have been
7836    // freed.
7837    optional uint64 free_count = 6;
7838  }
7839
7840  message Histogram {
7841    message Bucket {
7842      // This bucket counts values from the previous bucket's (or -infinity if
7843      // this is the first bucket) upper_limit (inclusive) to this upper_limit
7844      // (exclusive).
7845      optional uint64 upper_limit = 1;
7846      // This is the highest bucket. This is set instead of the upper_limit. Any
7847      // values larger or equal to the previous bucket's upper_limit are counted
7848      // in this bucket.
7849      optional bool max_bucket = 2;
7850      // Number of values that fall into this range.
7851      optional uint64 count = 3;
7852    }
7853    repeated Bucket buckets = 1;
7854  }
7855
7856  message ProcessStats {
7857    optional uint64 unwinding_errors = 1;
7858    optional uint64 heap_samples = 2;
7859    optional uint64 map_reparses = 3;
7860    optional Histogram unwinding_time_us = 4;
7861    optional uint64 total_unwinding_time_us = 5;
7862    optional uint64 client_spinlock_blocked_us = 6;
7863  }
7864
7865  repeated ProcessHeapSamples process_dumps = 5;
7866  message ProcessHeapSamples {
7867    enum ClientError {
7868      CLIENT_ERROR_NONE = 0;
7869      CLIENT_ERROR_HIT_TIMEOUT = 1;
7870      CLIENT_ERROR_INVALID_STACK_BOUNDS = 2;
7871    }
7872    optional uint64 pid = 1;
7873
7874    // This process was profiled from startup.
7875    // If false, this process was already running when profiling started.
7876    optional bool from_startup = 3;
7877
7878    // This process was not profiled because a concurrent session was active.
7879    // If this is true, samples will be empty.
7880    optional bool rejected_concurrent = 4;
7881
7882    // This process disconnected while it was profiled.
7883    // If false, the process outlived the profiling session.
7884    optional bool disconnected = 6;
7885
7886    // If disconnected, this disconnect was caused by the client overrunning
7887    // the buffer.
7888    // Equivalent to client_error == CLIENT_ERROR_HIT_TIMEOUT
7889    // on new S builds.
7890    optional bool buffer_overran = 7;
7891
7892    optional ClientError client_error = 14;
7893
7894    // If disconnected, this disconnected was caused by the shared memory
7895    // buffer being corrupted. THIS IS ALWAYS A BUG IN HEAPPROFD OR CLIENT
7896    // MEMORY CORRUPTION.
7897    optional bool buffer_corrupted = 8;
7898
7899    // If disconnected, this disconnect was caused by heapprofd exceeding
7900    // guardrails during this profiling session.
7901    optional bool hit_guardrail = 10;
7902
7903    optional string heap_name = 11;
7904    optional uint64 sampling_interval_bytes = 12;
7905    optional uint64 orig_sampling_interval_bytes = 13;
7906
7907    // Timestamp of the state of the target process that this dump represents.
7908    // This can be different to the timestamp of the TracePackets for various
7909    // reasons:
7910    // * If disconnected is set above, this is the timestamp of last state
7911    //   heapprofd had of the process before it disconnected.
7912    // * Otherwise, if the rate of events produced by the process is high,
7913    //   heapprofd might be behind.
7914    //
7915    // TODO(fmayer): This is MONOTONIC_COARSE. Refactor ClockSnapshot::Clock
7916    //               to have a type enum that we can reuse here.
7917    optional uint64 timestamp = 9;
7918
7919    // Metadata about heapprofd.
7920    optional ProcessStats stats = 5;
7921
7922    repeated HeapSample samples = 2;
7923  }
7924
7925  // If this is true, the next ProfilePacket in this package_sequence_id is a
7926  // continuation of this one.
7927  // To get all samples for a process, accummulate its
7928  // ProcessHeapSamples.samples until you see continued=false.
7929  optional bool continued = 6;
7930
7931  // Index of this ProfilePacket on its package_sequence_id. Can be used
7932  // to detect dropped data.
7933  // Verify these are consecutive.
7934  optional uint64 index = 7;
7935}
7936
7937message StreamingAllocation {
7938  // TODO(fmayer): Add callstack.
7939  repeated uint64 address = 1;
7940  repeated uint64 size = 2;
7941  repeated uint64 sample_size = 3;
7942  repeated uint64 clock_monotonic_coarse_timestamp = 4;
7943  repeated uint32 heap_id = 5;
7944  repeated uint64 sequence_number = 6;
7945};
7946
7947message StreamingFree {
7948  // TODO(fmayer): Add callstack.
7949  repeated uint64 address = 1;
7950  repeated uint32 heap_id = 2;
7951  repeated uint64 sequence_number = 3;
7952};
7953
7954// Message used to represent individual stack samples sampled at discrete
7955// points in time, rather than aggregated over an interval.
7956message StreamingProfilePacket {
7957  // Index into InternedData.callstacks
7958  repeated uint64 callstack_iid = 1;
7959  // TODO(eseckler): ThreadDescriptor-based timestamps are deprecated. Replace
7960  // this with ClockSnapshot-based delta encoding instead.
7961  repeated int64 timestamp_delta_us = 2;
7962  optional int32 process_priority = 3;
7963}
7964
7965// Namespace for the contained enums.
7966message Profiling {
7967  enum CpuMode {
7968    MODE_UNKNOWN = 0;
7969    MODE_KERNEL = 1;
7970    MODE_USER = 2;
7971    // The following values aren't expected, but included for completeness:
7972    MODE_HYPERVISOR = 3;
7973    MODE_GUEST_KERNEL = 4;
7974    MODE_GUEST_USER = 5;
7975  }
7976
7977  // Enumeration of libunwindstack's error codes.
7978  // NB: the integral representations of the two enums are different.
7979  enum StackUnwindError {
7980    UNWIND_ERROR_UNKNOWN = 0;
7981    UNWIND_ERROR_NONE = 1;
7982    UNWIND_ERROR_MEMORY_INVALID = 2;
7983    UNWIND_ERROR_UNWIND_INFO = 3;
7984    UNWIND_ERROR_UNSUPPORTED = 4;
7985    UNWIND_ERROR_INVALID_MAP = 5;
7986    UNWIND_ERROR_MAX_FRAMES_EXCEEDED = 6;
7987    UNWIND_ERROR_REPEATED_FRAME = 7;
7988    UNWIND_ERROR_INVALID_ELF = 8;
7989    UNWIND_ERROR_SYSTEM_CALL = 9;
7990    UNWIND_ERROR_THREAD_TIMEOUT = 10;
7991    UNWIND_ERROR_THREAD_DOES_NOT_EXIST = 11;
7992  }
7993}
7994
7995// Individual performance sampling packet payload. Typically corresponds to a
7996// stack sample on a configration-dependent counter overflow.
7997//
7998// Timestamps are within the root packet. This used to use the CLOCK_BOOTTIME
7999// domain, but now the default is CLOCK_MONOTONIC_RAW which is compatible with
8000// more event types.
8001//
8002// There are several distinct views of this message:
8003// * completely processed sample (callstack_iid set)
8004// * indication of kernel buffer data loss (kernel_records_lost set)
8005// * indication of skipped samples (sample_skipped_reason set)
8006// * notable event in the sampling implementation (producer_event set)
8007message PerfSample {
8008  optional uint32 cpu = 1;
8009  optional uint32 pid = 2;
8010  optional uint32 tid = 3;
8011
8012  // Execution state that the process was sampled at.
8013  optional Profiling.CpuMode cpu_mode = 5;
8014
8015  // Value of the timebase counter (since the event was configured, no deltas).
8016  optional uint64 timebase_count = 6;
8017
8018  // Unwound callstack. Might be partial, in which case a synthetic "error"
8019  // frame is appended, and |unwind_error| is set accordingly.
8020  optional uint64 callstack_iid = 4;
8021
8022  // If set, stack unwinding was incomplete due to an error.
8023  // Unset values should be treated as UNWIND_ERROR_NONE.
8024  oneof optional_unwind_error { Profiling.StackUnwindError unwind_error = 16; };
8025
8026  // If set, indicates that this message is not a sample, but rather an
8027  // indication of data loss in the ring buffer allocated for |cpu|. Such data
8028  // loss occurs when the kernel has insufficient ring buffer capacity to write
8029  // a record (which gets discarded). A record in this context is an individual
8030  // ring buffer entry, and counts more than just sample records.
8031  //
8032  // The |timestamp| of the packet corresponds to the time that the producer
8033  // wrote the packet for trace-sorting purposes alone, and should not be
8034  // interpreted relative to the sample timestamps. This field is sufficient to
8035  // detect that *some* kernel data loss happened within the trace, but not the
8036  // specific time bounds of that loss (which would require tracking precedessor
8037  // & successor timestamps, which is not deemed necessary at the moment).
8038  optional uint64 kernel_records_lost = 17;
8039
8040  // If set, indicates that the profiler encountered a sample that was relevant,
8041  // but was skipped.
8042  enum SampleSkipReason {
8043    PROFILER_SKIP_UNKNOWN = 0;
8044    PROFILER_SKIP_READ_STAGE = 1;
8045    PROFILER_SKIP_UNWIND_STAGE = 2;
8046    PROFILER_SKIP_UNWIND_ENQUEUE = 3;
8047  }
8048  oneof optional_sample_skipped_reason {
8049    SampleSkipReason sample_skipped_reason = 18;
8050  };
8051
8052  // A notable event within the sampling implementation.
8053  message ProducerEvent {
8054    enum DataSourceStopReason {
8055      PROFILER_STOP_UNKNOWN = 0;
8056      PROFILER_STOP_GUARDRAIL = 1;
8057    }
8058    oneof optional_source_stop_reason {
8059      DataSourceStopReason source_stop_reason = 1;
8060    }
8061  }
8062  optional ProducerEvent producer_event = 19;
8063}
8064
8065// Submessage for TracePacketDefaults.
8066message PerfSampleDefaults {
8067  // The sampling timebase. Might not be identical to the data source config if
8068  // the implementation decided to default/override some parameters.
8069  optional PerfEvents.Timebase timebase = 1;
8070}
8071// End of protos/perfetto/trace/profiling/profile_packet.proto
8072
8073// Begin of protos/perfetto/trace/profiling/smaps.proto
8074
8075message SmapsEntry {
8076  optional string path = 1;
8077  optional uint64 size_kb = 2;
8078  optional uint64 private_dirty_kb = 3;
8079  optional uint64 swap_kb = 4;
8080
8081  // for field upload (instead of path).
8082  optional string file_name = 5;
8083
8084  // TODO(crbug.com/1098746): Consider encoding this as incremental values.
8085  optional uint64 start_address = 6;
8086  optional uint64 module_timestamp = 7;
8087  optional string module_debugid = 8;
8088  optional string module_debug_path = 9;
8089  optional uint32 protection_flags = 10;
8090
8091  optional uint64 private_clean_resident_kb = 11;
8092  optional uint64 shared_dirty_resident_kb = 12;
8093  optional uint64 shared_clean_resident_kb = 13;
8094  optional uint64 locked_kb = 14;
8095  optional uint64 proportional_resident_kb = 15;
8096};
8097
8098message SmapsPacket {
8099  optional uint32 pid = 1;
8100  repeated SmapsEntry entries = 2;
8101};
8102
8103// End of protos/perfetto/trace/profiling/smaps.proto
8104
8105// Begin of protos/perfetto/trace/ps/process_stats.proto
8106
8107// Per-process periodically sampled stats. These samples are wrapped in a
8108// dedicated message (as opposite to be fields in process_tree.proto) because
8109// they are dumped at a different rate than cmdline and thread list.
8110// Note: not all of these stats will be present in every ProcessStats message
8111// and sometimes processes may be missing . This is because counters are
8112// cached to reduce emission of counters which do not change.
8113message ProcessStats {
8114  // Per-thread periodically sampled stats.
8115  // Note: not all of these stats will be present in every message. See the note
8116  // for ProcessStats.
8117  message Thread {
8118    optional int32 tid = 1;
8119
8120    // Pairs of frequency (represented as a (1-based) index to CpuInfo
8121    // frequencies) and time at that frequency (represented as a number of
8122    // ticks, see SystemInfo for the HZ (ticks / second) value to convert this
8123    // to time). Frequencies with zero ticks are never uploaded. Read from
8124    // /proc/tid/time_in_state.
8125    repeated uint32 cpu_freq_indices = 2;
8126    repeated uint64 cpu_freq_ticks = 3;
8127    // Whether all frequencies with non-zero ticks are present in
8128    // `cpu_freq_indices`. This marker is used to detect packets that describe
8129    // time_in_state exhaustively.
8130    optional bool cpu_freq_full = 4;
8131  }
8132
8133  message Process {
8134    optional int32 pid = 1;
8135
8136    // See /proc/[pid]/status in `man 5 proc` for a description of these fields.
8137    optional uint64 vm_size_kb = 2;
8138    optional uint64 vm_rss_kb = 3;
8139    optional uint64 rss_anon_kb = 4;
8140    optional uint64 rss_file_kb = 5;
8141    optional uint64 rss_shmem_kb = 6;
8142    optional uint64 vm_swap_kb = 7;
8143    optional uint64 vm_locked_kb = 8;
8144    optional uint64 vm_hwm_kb = 9;
8145    // When adding a new field remember to update kProcMemCounterSize in
8146    // the trace processor.
8147
8148    optional int64 oom_score_adj = 10;
8149
8150    repeated Thread threads = 11;
8151
8152    // The peak resident set size is resettable in newer Posix kernels.
8153    // This field specifies if reset is supported and if the writer had reset
8154    // the peaks after each process stats recording.
8155    optional bool is_peak_rss_resettable = 12;
8156
8157    // Private, shared and swap footprint of the process as measured by
8158    // Chrome. To know more about these metrics refer to:
8159    // https://docs.google.com/document/d/1_WmgE1F5WUrhwkPqJis3dWyOiUmQKvpXp5cd4w86TvA
8160    optional uint32 chrome_private_footprint_kb = 13;
8161    optional uint32 chrome_peak_resident_set_kb = 14;
8162  }
8163  repeated Process processes = 1;
8164
8165  // The time at which we finish collecting this batch of samples;
8166  // the top-level packet timestamp is the time at which
8167  // we begin collection.
8168  // TODO(dancol): analysis might be improved by
8169  // time-bracketing each sample as well as the whole
8170  // ProcessStats, but doing that is probably gated on
8171  // a vdso for CLOCK_BOOTTIME.
8172  optional uint64 collection_end_timestamp = 2;
8173}
8174
8175// End of protos/perfetto/trace/ps/process_stats.proto
8176
8177// Begin of protos/perfetto/trace/ps/process_tree.proto
8178
8179// Metadata about the processes and threads in the trace.
8180// Note: this proto was designed to be filled in by traced_probes and should
8181// only be populated with accurate information coming from the system. Other
8182// trace writers should prefer to fill ThreadDescriptor and ProcessDescriptor
8183// in TrackDescriptor.
8184message ProcessTree {
8185  // Representation of a thread.
8186  message Thread {
8187    // The thread id (as per gettid())
8188    optional int32 tid = 1;
8189
8190    // Thread group id (i.e. the PID of the process, == TID of the main thread)
8191    optional int32 tgid = 3;
8192
8193    // The name of the thread.
8194    optional string name = 2;
8195  }
8196
8197  // Representation of a process.
8198  message Process {
8199    // The UNIX process ID, aka thread group ID (as per getpid()).
8200    optional int32 pid = 1;
8201
8202    // The parent process ID, as per getppid().
8203    optional int32 ppid = 2;
8204
8205    // The command line for the process, as per /proc/pid/cmdline.
8206    // If it is a kernel thread there will only be one cmdline field
8207    // and it will contain /proc/pid/comm.
8208    repeated string cmdline = 3;
8209
8210    // No longer used as of Apr 2018, when the dedicated |threads| field was
8211    // introduced in ProcessTree.
8212    repeated Thread threads_deprecated = 4 [deprecated = true];
8213
8214    // The uid for the process, as per /proc/pid/status.
8215    optional int32 uid = 5;
8216  }
8217
8218  // List of processes and threads in the client. These lists are incremental
8219  // and not exhaustive. A process and its threads might show up separately in
8220  // different ProcessTree messages. A thread might event not show up at all, if
8221  // no sched_switch activity was detected, for instance:
8222  // #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] }
8223  // #1 { threads: [{pid: 12, tgid: 10}] }
8224  // #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] }
8225  repeated Process processes = 1;
8226  repeated Thread threads = 2;
8227
8228  // The time at which we finish collecting this process tree;
8229  // the top-level packet timestamp is the time at which
8230  // we begin collection.
8231  optional uint64 collection_end_timestamp = 3;
8232}
8233
8234// End of protos/perfetto/trace/ps/process_tree.proto
8235
8236// Begin of protos/perfetto/trace/sys_stats/sys_stats.proto
8237
8238// Various Linux system stat counters from /proc.
8239// The fields in this message can be reported at different rates and with
8240// different granularity. See sys_stats_config.proto.
8241message SysStats {
8242  // Counters from /proc/meminfo. Values are in KB.
8243  message MeminfoValue {
8244    optional MeminfoCounters key = 1;
8245    optional uint64 value = 2;
8246  };
8247  repeated MeminfoValue meminfo = 1;
8248
8249  // Counter from /proc/vmstat. Units are often pages, not KB.
8250  message VmstatValue {
8251    optional VmstatCounters key = 1;
8252    optional uint64 value = 2;
8253  };
8254  repeated VmstatValue vmstat = 2;
8255
8256  // Times in each mode, since boot. Unit: nanoseconds.
8257  message CpuTimes {
8258    optional uint32 cpu_id = 1;
8259
8260    // Time spent in user mode.
8261    optional uint64 user_ns = 2;
8262
8263    // Time spent in user mode (low prio).
8264    optional uint64 user_ice_ns = 3;
8265
8266    // Time spent in system mode.
8267    optional uint64 system_mode_ns = 4;
8268
8269    // Time spent in the idle task.
8270    optional uint64 idle_ns = 5;
8271
8272    // Time spent waiting for I/O.
8273    optional uint64 io_wait_ns = 6;
8274
8275    // Time spent servicing interrupts.
8276    optional uint64 irq_ns = 7;
8277
8278    // Time spent servicing softirqs.
8279    optional uint64 softirq_ns = 8;
8280  }
8281  // One entry per cpu.
8282  repeated CpuTimes cpu_stat = 3;
8283
8284  // Num processes forked since boot.
8285  // Populated only if FORK_COUNT in config.stat_counters.
8286  optional uint64 num_forks = 4;
8287
8288  message InterruptCount {
8289    optional int32 irq = 1;
8290    optional uint64 count = 2;
8291  }
8292
8293  // Number of interrupts, broken by IRQ number.
8294  // Populated only if IRQ_COUNTS in config.stat_counters.
8295
8296  // Total num of irqs serviced since boot.
8297  optional uint64 num_irq_total = 5;
8298  repeated InterruptCount num_irq = 6;
8299
8300  // Number of softirqs, broken by softirq number.
8301  // Populated only if SOFTIRQ_COUNTS in config.stat_counters.
8302
8303  // Total num of softirqs since boot.
8304  optional uint64 num_softirq_total = 7;
8305
8306  // Per-softirq count.
8307  repeated InterruptCount num_softirq = 8;
8308
8309  // The time at which we finish collecting this set of samples;
8310  // the top-level packet timestamp is the time at which
8311  // we begin collection.
8312  optional uint64 collection_end_timestamp = 9;
8313
8314  // Frequencies for /sys/class/devfreq/ entries in kHz.
8315  message DevfreqValue {
8316    optional string key = 1;
8317    optional uint64 value = 2;
8318  };
8319
8320  // One entry per device.
8321  repeated DevfreqValue devfreq = 10;
8322}
8323
8324// End of protos/perfetto/trace/sys_stats/sys_stats.proto
8325
8326// Begin of protos/perfetto/trace/system_info.proto
8327
8328message Utsname {
8329  optional string sysname = 1;
8330  optional string version = 2;
8331  optional string release = 3;
8332  optional string machine = 4;
8333}
8334
8335message SystemInfo {
8336  optional Utsname utsname = 1;
8337  optional string android_build_fingerprint = 2;
8338
8339  // Ticks per second - sysconf(_SC_CLK_TCK).
8340  optional int64 hz = 3;
8341
8342  // The version of traced (the same returned by `traced --version`).
8343  // This is a human readable string with and its format varies depending on
8344  // the build system and the repo (standalone vs AOSP).
8345  // This is intended for human debugging only.
8346  optional string tracing_service_version = 4;
8347}
8348
8349// End of protos/perfetto/trace/system_info.proto
8350
8351// Begin of protos/perfetto/trace/system_info/cpu_info.proto
8352
8353// Information about CPUs from procfs and sysfs.
8354message CpuInfo {
8355  // Information about a single CPU.
8356  message Cpu {
8357    // Value of "Processor" field from /proc/cpuinfo for this CPU.
8358    // Example: "AArch64 Processor rev 12 (aarch64)"
8359    optional string processor = 1;
8360
8361    // Frequencies from
8362    // /sys/devices/system/cpu/cpuX/cpufreq/scaling_available_frequencies
8363    // where X is the index of this CPU.
8364    repeated uint32 frequencies = 2;
8365  }
8366
8367  // Describes available CPUs, one entry per CPU.
8368  repeated Cpu cpus = 1;
8369}
8370
8371// End of protos/perfetto/trace/system_info/cpu_info.proto
8372
8373// Begin of protos/perfetto/trace/test_event.proto
8374
8375// Event used by testing code.
8376message TestEvent {
8377  // Arbitrary string used in tests.
8378  optional string str = 1;
8379
8380  // The current value of the random number sequence used in tests.
8381  optional uint32 seq_value = 2;
8382
8383  // Monotonically increased on each packet.
8384  optional uint64 counter = 3;
8385
8386  // No more packets should follow (from the current sequence).
8387  optional bool is_last = 4;
8388
8389  message TestPayload {
8390    repeated string str = 1;
8391    repeated TestPayload nested = 2;
8392
8393    optional string single_string = 4;
8394
8395    optional int32 single_int = 5;
8396    repeated int32 repeated_ints = 6;
8397
8398    // When 0 this is the bottom-most nested message.
8399    optional uint32 remaining_nesting_depth = 3;
8400  }
8401  optional TestPayload payload = 5;
8402}
8403
8404// End of protos/perfetto/trace/test_event.proto
8405
8406// Begin of protos/perfetto/trace/trace_packet_defaults.proto
8407
8408// Default values for TracePacket fields that hold for a particular TraceWriter
8409// packet sequence. This message contains a subset of the TracePacket fields
8410// with matching IDs. When provided, these fields define the default values
8411// that should be applied, at import time, to all TracePacket(s) with the same
8412// |trusted_packet_sequence_id|, unless otherwise specified in each packet.
8413//
8414// Should be reemitted whenever incremental state is cleared on the sequence.
8415message TracePacketDefaults {
8416  optional uint32 timestamp_clock_id = 58;
8417
8418  // Default values for TrackEvents (e.g. default track).
8419  optional TrackEventDefaults track_event_defaults = 11;
8420
8421  // Defaults for perf profiler packets (PerfSample).
8422  optional PerfSampleDefaults perf_sample_defaults = 12;
8423}
8424// End of protos/perfetto/trace/trace_packet_defaults.proto
8425
8426// Begin of protos/perfetto/trace/track_event/process_descriptor.proto
8427
8428// Describes a process's attributes. Emitted as part of a TrackDescriptor,
8429// usually by the process's main thread.
8430//
8431// Next id: 8.
8432message ProcessDescriptor {
8433  optional int32 pid = 1;
8434  repeated string cmdline = 2;
8435  optional string process_name = 6;
8436
8437  optional int32 process_priority = 5;
8438  // Process start time in nanoseconds.
8439  // The timestamp refers to the trace clock by default. Other clock IDs
8440  // provided in TracePacket are not supported.
8441  optional int64 start_timestamp_ns = 7;
8442
8443  // ---------------------------------------------------------------------------
8444  // Deprecated / legacy fields, which will be removed in the future:
8445  // ---------------------------------------------------------------------------
8446
8447  // See chromium's content::ProcessType.
8448  enum ChromeProcessType {
8449    PROCESS_UNSPECIFIED = 0;
8450    PROCESS_BROWSER = 1;
8451    PROCESS_RENDERER = 2;
8452    PROCESS_UTILITY = 3;
8453    PROCESS_ZYGOTE = 4;
8454    PROCESS_SANDBOX_HELPER = 5;
8455    PROCESS_GPU = 6;
8456    PROCESS_PPAPI_PLUGIN = 7;
8457    PROCESS_PPAPI_BROKER = 8;
8458  }
8459  optional ChromeProcessType chrome_process_type = 4;
8460
8461  // To support old UI. New UI should determine default sorting by process_type.
8462  optional int32 legacy_sort_index = 3;
8463}
8464
8465// End of protos/perfetto/trace/track_event/process_descriptor.proto
8466
8467// Begin of protos/perfetto/trace/track_event/thread_descriptor.proto
8468
8469// Describes a thread's attributes. Emitted as part of a TrackDescriptor,
8470// usually by the thread's trace writer.
8471//
8472// Next id: 9.
8473message ThreadDescriptor {
8474  optional int32 pid = 1;
8475  optional int32 tid = 2;
8476
8477  optional string thread_name = 5;
8478
8479  // ---------------------------------------------------------------------------
8480  // Deprecated / legacy fields, which will be removed in the future:
8481  // ---------------------------------------------------------------------------
8482
8483  enum ChromeThreadType {
8484    CHROME_THREAD_UNSPECIFIED = 0;
8485
8486    CHROME_THREAD_MAIN = 1;
8487    CHROME_THREAD_IO = 2;
8488
8489    // Scheduler:
8490    CHROME_THREAD_POOL_BG_WORKER = 3;
8491    CHROME_THREAD_POOL_FG_WORKER = 4;
8492    CHROME_THREAD_POOL_FB_BLOCKING = 5;
8493    CHROME_THREAD_POOL_BG_BLOCKING = 6;
8494    CHROME_THREAD_POOL_SERVICE = 7;
8495
8496    // Compositor:
8497    CHROME_THREAD_COMPOSITOR = 8;
8498    CHROME_THREAD_VIZ_COMPOSITOR = 9;
8499    CHROME_THREAD_COMPOSITOR_WORKER = 10;
8500
8501    // Renderer:
8502    CHROME_THREAD_SERVICE_WORKER = 11;
8503
8504    // Tracing related threads:
8505    CHROME_THREAD_MEMORY_INFRA = 50;
8506    CHROME_THREAD_SAMPLING_PROFILER = 51;
8507  };
8508  optional ChromeThreadType chrome_thread_type = 4;
8509
8510  // Deprecated. Use ClockSnapshot in combination with TracePacket's timestamp
8511  // and timestamp_clock_id fields instead.
8512  optional int64 reference_timestamp_us = 6;
8513
8514  // Absolute reference values. Clock values in subsequent TrackEvents can be
8515  // encoded accumulatively and relative to these. This reduces their var-int
8516  // encoding size.
8517  // TODO(eseckler): Deprecated. Replace these with ClockSnapshot encoding.
8518  optional int64 reference_thread_time_us = 7;
8519  optional int64 reference_thread_instruction_count = 8;
8520
8521  // To support old UI. New UI should determine default sorting by thread_type.
8522  optional int32 legacy_sort_index = 3;
8523}
8524
8525// End of protos/perfetto/trace/track_event/thread_descriptor.proto
8526
8527// Begin of protos/perfetto/trace/track_event/chrome_process_descriptor.proto
8528
8529// Describes the attributes for a Chrome process. Must be paired with a
8530// ProcessDescriptor in the same TrackDescriptor.
8531//
8532// Next id: 6.
8533message ChromeProcessDescriptor {
8534  // See chromium's content::ProcessType.
8535  enum ProcessType {
8536    PROCESS_UNSPECIFIED = 0;
8537    PROCESS_BROWSER = 1;
8538    PROCESS_RENDERER = 2;
8539    PROCESS_UTILITY = 3;
8540    PROCESS_ZYGOTE = 4;
8541    PROCESS_SANDBOX_HELPER = 5;
8542    PROCESS_GPU = 6;
8543    PROCESS_PPAPI_PLUGIN = 7;
8544    PROCESS_PPAPI_BROKER = 8;
8545    PROCESS_SERVICE_NETWORK = 9;
8546    PROCESS_SERVICE_TRACING = 10;
8547    PROCESS_SERVICE_STORAGE = 11;
8548    PROCESS_SERVICE_AUDIO = 12;
8549    PROCESS_SERVICE_DATA_DECODER = 13;
8550    PROCESS_SERVICE_UTIL_WIN = 14;
8551    PROCESS_SERVICE_PROXY_RESOLVER = 15;
8552    PROCESS_SERVICE_CDM = 16;
8553    PROCESS_SERVICE_VIDEO_CAPTURE = 17;
8554    PROCESS_SERVICE_UNZIPPER = 18;
8555    PROCESS_SERVICE_MIRRORING = 19;
8556    PROCESS_SERVICE_FILEPATCHER = 20;
8557    PROCESS_SERVICE_TTS = 21;
8558    PROCESS_SERVICE_PRINTING = 22;
8559    PROCESS_SERVICE_QUARANTINE = 23;
8560    PROCESS_SERVICE_CROS_LOCALSEARCH = 24;
8561    PROCESS_SERVICE_CROS_ASSISTANT_AUDIO_DECODER = 25;
8562    PROCESS_SERVICE_FILEUTIL = 26;
8563    PROCESS_SERVICE_PRINTCOMPOSITOR = 27;
8564    PROCESS_SERVICE_PAINTPREVIEW = 28;
8565    PROCESS_SERVICE_SPEECHRECOGNITION = 29;
8566    PROCESS_SERVICE_XRDEVICE = 30;
8567    PROCESS_SERVICE_READICON = 31;
8568    PROCESS_SERVICE_LANGUAGEDETECTION = 32;
8569    PROCESS_SERVICE_SHARING = 33;
8570    PROCESS_SERVICE_MEDIAPARSER = 34;
8571    PROCESS_SERVICE_QRCODEGENERATOR = 35;
8572    PROCESS_SERVICE_PROFILEIMPORT = 36;
8573    PROCESS_SERVICE_IME = 37;
8574    PROCESS_SERVICE_RECORDING = 38;
8575    PROCESS_SERVICE_SHAPEDETECTION = 39;
8576  }
8577  optional ProcessType process_type = 1;
8578  optional int32 process_priority = 2;
8579
8580  // To support old UI. New UI should determine default sorting by process_type.
8581  optional int32 legacy_sort_index = 3;
8582
8583  // Name of the hosting app for WebView. Used to match renderer processes to
8584  // their hosting apps.
8585  optional string host_app_package_name = 4;
8586
8587  // The ID to link crashes to trace.
8588  // Notes:
8589  // * The ID is per process. So, each trace may contain many IDs, and you need
8590  //   to look for the ID from crashed process to find the crash report.
8591  // * Having a "chrome-trace-id" in crash doesn't necessarily mean we can
8592  //   get an uploaded trace, since uploads could have failed.
8593  // * On the other hand, if there was a crash during the session and trace was
8594  //   uploaded, it is very likely to find a crash report with the trace ID.
8595  // * This is not crash ID or trace ID. It is just a random 64-bit number
8596  //   recorded in both traces and crashes. It is possible to have collisions,
8597  //   though very rare.
8598  optional uint64 crash_trace_id = 5;
8599}
8600
8601// End of protos/perfetto/trace/track_event/chrome_process_descriptor.proto
8602
8603// Begin of protos/perfetto/trace/track_event/chrome_thread_descriptor.proto
8604
8605// Describes a Chrome thread's attributes. Emitted as part of a TrackDescriptor,
8606// usually by the thread's trace writer. Must be paired with a ThreadDescriptor
8607// in the same TrackDescriptor.
8608//
8609// Next id: 3.
8610message ChromeThreadDescriptor {
8611  enum ThreadType {
8612    THREAD_UNSPECIFIED = 0;
8613
8614    THREAD_MAIN = 1;
8615    THREAD_IO = 2;
8616
8617    THREAD_POOL_BG_WORKER = 3;
8618    THREAD_POOL_FG_WORKER = 4;
8619    THREAD_POOL_FG_BLOCKING = 5;
8620    THREAD_POOL_BG_BLOCKING = 6;
8621    THREAD_POOL_SERVICE = 7;
8622
8623    THREAD_COMPOSITOR = 8;
8624    THREAD_VIZ_COMPOSITOR = 9;
8625    THREAD_COMPOSITOR_WORKER = 10;
8626
8627    THREAD_SERVICE_WORKER = 11;
8628    THREAD_NETWORK_SERVICE = 12;
8629
8630    THREAD_CHILD_IO = 13;
8631    THREAD_BROWSER_IO = 14;
8632
8633    THREAD_BROWSER_MAIN = 15;
8634    THREAD_RENDERER_MAIN = 16;
8635    THREAD_UTILITY_MAIN = 17;
8636    THREAD_GPU_MAIN = 18;
8637
8638    THREAD_CACHE_BLOCKFILE = 19;
8639    THREAD_MEDIA = 20;
8640    THREAD_AUDIO_OUTPUTDEVICE = 21;
8641    THREAD_AUDIO_INPUTDEVICE = 22;
8642    THREAD_GPU_MEMORY = 23;
8643    THREAD_GPU_VSYNC = 24;
8644    THREAD_DXA_VIDEODECODER = 25;
8645    THREAD_BROWSER_WATCHDOG = 26;
8646    THREAD_WEBRTC_NETWORK = 27;
8647    THREAD_WINDOW_OWNER = 28;
8648    THREAD_WEBRTC_SIGNALING = 29;
8649    THREAD_WEBRTC_WORKER = 30;
8650    THREAD_PPAPI_MAIN = 31;
8651    THREAD_GPU_WATCHDOG = 32;
8652    THREAD_SWAPPER = 33;
8653    THREAD_GAMEPAD_POLLING = 34;
8654    THREAD_WEBCRYPTO = 35;
8655    THREAD_DATABASE = 36;
8656    THREAD_PROXYRESOLVER = 37;
8657    THREAD_DEVTOOLSADB = 38;
8658    THREAD_NETWORKCONFIGWATCHER = 39;
8659    THREAD_WASAPI_RENDER = 40;
8660
8661    THREAD_MEMORY_INFRA = 50;
8662    THREAD_SAMPLING_PROFILER = 51;
8663  };
8664
8665  optional ThreadType thread_type = 1;
8666
8667  // To support old UI. New UI should determine default sorting by thread_type.
8668  optional int32 legacy_sort_index = 2;
8669}
8670
8671// End of protos/perfetto/trace/track_event/chrome_thread_descriptor.proto
8672
8673// Begin of protos/perfetto/trace/track_event/counter_descriptor.proto
8674
8675// Defines properties of a counter track, e.g. for built-in counters (thread
8676// time, instruction count, ..) or user-specified counters (e.g. memory usage of
8677// a specific app component).
8678//
8679// Counter tracks only support TYPE_COUNTER track events, which specify new
8680// values for the counter. For counters that require per-slice values, counter
8681// values can instead be provided in a more efficient encoding via TrackEvent's
8682// |extra_counter_track_uuids| and |extra_counter_values| fields. However,
8683// slice-type events cannot be emitted onto a counter track.
8684//
8685// Values for counters that are only emitted on a single packet sequence can
8686// optionally be delta-encoded, see |is_incremental|.
8687//
8688// Next id: 7.
8689message CounterDescriptor {
8690  // Built-in counters, usually with special meaning in the client library,
8691  // trace processor, legacy JSON format, or UI. Trace processor will infer a
8692  // track name from the enum value if none is provided in TrackDescriptor.
8693  enum BuiltinCounterType {
8694    COUNTER_UNSPECIFIED = 0;
8695
8696    // Thread-scoped counters. The thread's track should be specified via
8697    // |parent_uuid| in the TrackDescriptor for such a counter.
8698
8699    // implies UNIT_TIME_NS.
8700    COUNTER_THREAD_TIME_NS = 1;
8701
8702    // implies UNIT_COUNT.
8703    COUNTER_THREAD_INSTRUCTION_COUNT = 2;
8704  }
8705
8706  // Type of the values for the counters - to supply lower granularity units,
8707  // see also |unit_multiplier|.
8708  enum Unit {
8709    UNIT_UNSPECIFIED = 0;
8710    UNIT_TIME_NS = 1;
8711    UNIT_COUNT = 2;
8712    UNIT_SIZE_BYTES = 3;
8713    // TODO(eseckler): Support more units as necessary.
8714  }
8715
8716  // For built-in counters (e.g. thread time). Custom user-specified counters
8717  // (e.g. those emitted by TRACE_COUNTER macros of the client library)
8718  // shouldn't set this, and instead provide a counter name via TrackDescriptor.
8719  optional BuiltinCounterType type = 1;
8720
8721  // Names of categories of the counter (usually for user-specified counters).
8722  // In the client library, categories are a way to turn groups of individual
8723  // counters (or events) on or off.
8724  repeated string categories = 2;
8725
8726  // Type of the counter's values. Built-in counters imply a value for this
8727  // field.
8728  optional Unit unit = 3;
8729
8730  // In order to use a unit not defined as a part of |Unit|, a free-form unit
8731  // name can be used instead.
8732  optional string unit_name = 6;
8733
8734  // Multiplication factor of this counter's values, e.g. to supply
8735  // COUNTER_THREAD_TIME_NS timestamps in microseconds instead.
8736  optional int64 unit_multiplier = 4;
8737
8738  // Whether values for this counter are provided as delta values. Only
8739  // supported for counters that are emitted on a single packet-sequence (e.g.
8740  // thread time). Counter values in subsequent packets on the current packet
8741  // sequence will be interpreted as delta values from the sequence's most
8742  // recent value for the counter. When incremental state is cleared, the
8743  // counter value is considered to be reset to 0. Thus, the first value after
8744  // incremental state is cleared is effectively an absolute value.
8745  optional bool is_incremental = 5;
8746
8747  // TODO(eseckler): Support arguments describing the counter (?).
8748  // repeated DebugAnnotation debug_annotations;
8749}
8750
8751// End of protos/perfetto/trace/track_event/counter_descriptor.proto
8752
8753// Begin of protos/perfetto/trace/track_event/track_descriptor.proto
8754
8755// Defines a track for TrackEvents. Slices and instant events on the same track
8756// will be nested based on their timestamps, see TrackEvent::Type.
8757//
8758// A TrackDescriptor only needs to be emitted by one trace writer / producer and
8759// is valid for the entirety of the trace. To ensure the descriptor isn't lost
8760// when the ring buffer wraps, it should be reemitted whenever incremental state
8761// is cleared.
8762//
8763// As a fallback, TrackEvents emitted without an explicit track association will
8764// be associated with an implicit trace-global track (uuid = 0), see also
8765// |TrackEvent::track_uuid|. It is possible but not necessary to emit a
8766// TrackDescriptor for this implicit track.
8767//
8768// Next id: 9.
8769message TrackDescriptor {
8770  // Unique ID that identifies this track. This ID is global to the whole trace.
8771  // Producers should ensure that it is unlikely to clash with IDs emitted by
8772  // other producers. A value of 0 denotes the implicit trace-global track.
8773  //
8774  // For example, legacy TRACE_EVENT macros may use a hash involving the async
8775  // event id + id_scope, pid, and/or tid to compute this ID.
8776  optional uint64 uuid = 1;
8777
8778  // A parent track reference can be used to describe relationships between
8779  // tracks. For example, to define an asynchronous track which is scoped to a
8780  // specific process, specify the uuid for that process's process track here.
8781  // Similarly, to associate a COUNTER_THREAD_TIME_NS counter track with a
8782  // thread, specify the uuid for that thread's thread track here.
8783  optional uint64 parent_uuid = 5;
8784
8785  // Name of the track. Optional - if unspecified, it may be derived from the
8786  // process/thread name (process/thread tracks), the first event's name (async
8787  // tracks), or counter name (counter tracks).
8788  optional string name = 2;
8789
8790  // Associate the track with a process, making it the process-global track.
8791  // There should only be one such track per process (usually for instant
8792  // events; trace processor uses this fact to detect pid reuse). If you need
8793  // more (e.g. for asynchronous events), create child tracks using parent_uuid.
8794  //
8795  // Trace processor will merge events on a process track with slice-type events
8796  // from other sources (e.g. ftrace) for the same process into a single
8797  // timeline view.
8798  optional ProcessDescriptor process = 3;
8799  optional ChromeProcessDescriptor chrome_process = 6;
8800
8801  // Associate the track with a thread, indicating that the track's events
8802  // describe synchronous code execution on the thread. There should only be one
8803  // such track per thread (trace processor uses this fact to detect tid reuse).
8804  //
8805  // Trace processor will merge events on a thread track with slice-type events
8806  // from other sources (e.g. ftrace) for the same thread into a single timeline
8807  // view.
8808  optional ThreadDescriptor thread = 4;
8809  optional ChromeThreadDescriptor chrome_thread = 7;
8810
8811  // Descriptor for a counter track. If set, the track will only support
8812  // TYPE_COUNTER TrackEvents (and values provided via TrackEvent's
8813  // |extra_counter_values|).
8814  optional CounterDescriptor counter = 8;
8815}
8816
8817// End of protos/perfetto/trace/track_event/track_descriptor.proto
8818
8819// Begin of protos/perfetto/trace/trigger.proto
8820
8821// When a TracingSession receives a trigger it records the boot time nanoseconds
8822// in the TracePacket's timestamp field as well as the name of the producer that
8823// triggered it. We emit this data so filtering can be done on triggers received
8824// in the trace.
8825message Trigger {
8826  // Name of the trigger which was received.
8827  optional string trigger_name = 1;
8828  // The actual producer that activated |trigger|.
8829  optional string producer_name = 2;
8830  // The verified UID of the producer.
8831  optional int32 trusted_producer_uid = 3;
8832}
8833
8834// End of protos/perfetto/trace/trigger.proto
8835
8836// Begin of protos/perfetto/trace/ui_state.proto
8837
8838// Common state for UIs visualizing Perfetto traces.
8839// This message can be appended as a TracePacket by UIs to save the
8840// visible state (e.g. scroll position/zoom state) for future opening
8841// of the trace.
8842// Design doc: go/trace-ui-state.
8843message UiState {
8844  // The start and end bounds of the viewport of the UI in nanoseconds.
8845  //
8846  // This is the absolute time associated to slices and other events in
8847  // trace processor tables (i.e. the |ts| column of most tables)
8848  optional int64 timeline_start_ts = 1;
8849  optional int64 timeline_end_ts = 2;
8850
8851  // Indicates that the given process should be highlighted by the UI.
8852  message HighlightProcess {
8853    oneof selector {
8854      // The pid of the process to highlight. This is useful for UIs to focus
8855      // on tracks of a particular process in the trace.
8856      //
8857      // If more than one process in a trace has the same pid, it is UI
8858      // implementation specific how the process to be focused will be
8859      // chosen.
8860      uint32 pid = 1;
8861
8862      // The command line of the process to highlight; for most Android apps,
8863      // this is the package name of the app. This is useful for UIs to focus
8864      // on a particular app in the trace.
8865      //
8866      // If more than one process hasthe same cmdline, it is UI implementation
8867      // specific how the process to be focused will be chosen.
8868      string cmdline = 2;
8869    }
8870  }
8871  optional HighlightProcess highlight_process = 3;
8872}
8873// End of protos/perfetto/trace/ui_state.proto
8874
8875// Begin of protos/perfetto/trace/trace_packet.proto
8876
8877// TracePacket is the root object of a Perfeto trace.
8878// A Perfetto trace is a linear sequence of TracePacket(s).
8879//
8880// The tracing service guarantees that all TracePacket(s) written by a given
8881// TraceWriter are seen in-order, without gaps or duplicates. If, for any
8882// reason, a TraceWriter sequence becomes invalid, no more packets are returned
8883// to the Consumer (or written into the trace file).
8884// TracePacket(s) written by different TraceWriter(s), hence even different
8885// data sources, can be seen in arbitrary order.
8886// The consumer can re-establish a total order, if interested, using the packet
8887// timestamps, after having synchronized the different clocks onto a global
8888// clock.
8889//
8890// The tracing service is agnostic of the content of TracePacket, with the
8891// exception of few fields (e.g.. trusted_*, trace_config) that are written by
8892// the service itself.
8893//
8894// See the [Buffers and Dataflow](/docs/concepts/buffers.md) doc for details.
8895//
8896// Next reserved id: 14 (up to 15).
8897// Next id: 79.
8898message TracePacket {
8899  // The timestamp of the TracePacket.
8900  // By default this timestamps refers to the trace clock (CLOCK_BOOTTIME on
8901  // Android). It can be overridden using a different timestamp_clock_id.
8902  // The clock domain definition in ClockSnapshot can also override:
8903  // - The unit (default: 1ns).
8904  // - The absolute vs delta encoding (default: absolute timestamp).
8905  optional uint64 timestamp = 8;
8906
8907  // Specifies the ID of the clock used for the TracePacket |timestamp|. Can be
8908  // one of the built-in types from ClockSnapshot::BuiltinClocks, or a
8909  // producer-defined clock id.
8910  // If unspecified and if no default per-sequence value has been provided via
8911  // TracePacketDefaults, it defaults to BuiltinClocks::BOOTTIME.
8912  optional uint32 timestamp_clock_id = 58;
8913
8914  oneof data {
8915    ProcessTree process_tree = 2;
8916    ProcessStats process_stats = 9;
8917    InodeFileMap inode_file_map = 4;
8918    ChromeEventBundle chrome_events = 5;
8919    ClockSnapshot clock_snapshot = 6;
8920    SysStats sys_stats = 7;
8921    TrackEvent track_event = 11;
8922
8923    // IDs up to 15 are reserved. They take only one byte to encode their
8924    // preamble so should be used for frequent events.
8925
8926    TraceConfig trace_config = 33;
8927    FtraceStats ftrace_stats = 34;
8928    TraceStats trace_stats = 35;
8929    ProfilePacket profile_packet = 37;
8930    StreamingAllocation streaming_allocation = 74;
8931    StreamingFree streaming_free = 75;
8932    BatteryCounters battery = 38;
8933    PowerRails power_rails = 40;
8934    AndroidLogPacket android_log = 39;
8935    SystemInfo system_info = 45;
8936    Trigger trigger = 46;
8937    PackagesList packages_list = 47;
8938    ChromeBenchmarkMetadata chrome_benchmark_metadata = 48;
8939    PerfettoMetatrace perfetto_metatrace = 49;
8940    ChromeMetadataPacket chrome_metadata = 51;
8941    GpuCounterEvent gpu_counter_event = 52;
8942    GpuRenderStageEvent gpu_render_stage_event = 53;
8943    StreamingProfilePacket streaming_profile_packet = 54;
8944    HeapGraph heap_graph = 56;
8945    GraphicsFrameEvent graphics_frame_event = 57;
8946    VulkanMemoryEvent vulkan_memory_event = 62;
8947    GpuLog gpu_log = 63;
8948    VulkanApiEvent vulkan_api_event = 65;
8949    PerfSample perf_sample = 66;
8950    CpuInfo cpu_info = 67;
8951    SmapsPacket smaps_packet = 68;
8952    TracingServiceEvent service_event = 69;
8953    InitialDisplayState initial_display_state = 70;
8954    GpuMemTotalEvent gpu_mem_total_event = 71;
8955    MemoryTrackerSnapshot memory_tracker_snapshot = 73;
8956    FrameTimelineEvent frame_timeline_event = 76;
8957    AndroidEnergyEstimationBreakdown android_energy_estimation_breakdown = 77;
8958    UiState ui_state = 78;
8959
8960    // Only used in profile packets.
8961    ProfiledFrameSymbols profiled_frame_symbols = 55;
8962    ModuleSymbols module_symbols = 61;
8963    DeobfuscationMapping deobfuscation_mapping = 64;
8964
8965    // Only used by TrackEvent.
8966    TrackDescriptor track_descriptor = 60;
8967
8968    // Deprecated, use TrackDescriptor instead.
8969    ProcessDescriptor process_descriptor = 43;
8970
8971    // Deprecated, use TrackDescriptor instead.
8972    ThreadDescriptor thread_descriptor = 44;
8973
8974    // Events from the Linux kernel ftrace infrastructure.
8975    FtraceEventBundle ftrace_events = 1;
8976
8977    // This field is emitted at periodic intervals (~10s) and
8978    // contains always the binary representation of the UUID
8979    // {82477a76-b28d-42ba-81dc-33326d57a079}. This is used to be able to
8980    // efficiently partition long traces without having to fully parse them.
8981    bytes synchronization_marker = 36;
8982
8983    // Zero or more proto encoded trace packets compressed using deflate.
8984    // Each compressed_packets TracePacket (including the two field ids and
8985    // sizes) should be less than 512KB.
8986    bytes compressed_packets = 50;
8987
8988    // Data sources can extend the trace proto with custom extension protos (see
8989    // docs/design-docs/extensions.md). When they do that, the descriptor of
8990    // their extension proto descriptor is serialized in this packet. This
8991    // allows trace_processor to deserialize extended messages using reflection
8992    // even if the extension proto is not checked in the Perfetto repo.
8993    ExtensionDescriptor extension_descriptor = 72;
8994
8995    // This field is only used for testing.
8996    // In previous versions of this proto this field had the id 268435455
8997    // This caused many problems:
8998    // - protozero decoder does not handle field ids larger than 999.
8999    // - old versions of protoc produce Java bindings with syntax errors when
9000    //   the field id is large enough.
9001    TestEvent for_testing = 900;
9002  }
9003
9004  // Trusted user id of the producer which generated this packet. Keep in sync
9005  // with TrustedPacket.trusted_uid.
9006  //
9007  // TODO(eseckler): Emit this field in a PacketSequenceDescriptor message
9008  // instead.
9009  oneof optional_trusted_uid { int32 trusted_uid = 3; };
9010
9011  // Service-assigned identifier of the packet sequence this packet belongs to.
9012  // Uniquely identifies a producer + writer pair within the tracing session. A
9013  // value of zero denotes an invalid ID. Keep in sync with
9014  // TrustedPacket.trusted_packet_sequence_id.
9015  oneof optional_trusted_packet_sequence_id {
9016    uint32 trusted_packet_sequence_id = 10;
9017  }
9018
9019  // Incrementally emitted interned data, valid only on the packet's sequence
9020  // (packets with the same |trusted_packet_sequence_id|). The writer will
9021  // usually emit new interned data in the same TracePacket that first refers to
9022  // it (since the last reset of interning state). It may also be emitted
9023  // proactively in advance of referring to them in later packets.
9024  optional InternedData interned_data = 12;
9025
9026  enum SequenceFlags {
9027    SEQ_UNSPECIFIED = 0;
9028
9029    // Set by the writer to indicate that it will re-emit any incremental data
9030    // for the packet's sequence before referring to it again. This includes
9031    // interned data as well as periodically emitted data like
9032    // Process/ThreadDescriptors. This flag only affects the current packet
9033    // sequence (see |trusted_packet_sequence_id|).
9034    //
9035    // When set, this TracePacket and subsequent TracePackets on the same
9036    // sequence will not refer to any incremental data emitted before this
9037    // TracePacket. For example, previously emitted interned data will be
9038    // re-emitted if it is referred to again.
9039    //
9040    // When the reader detects packet loss (|previous_packet_dropped|), it needs
9041    // to skip packets in the sequence until the next one with this flag set, to
9042    // ensure intact incremental data.
9043    SEQ_INCREMENTAL_STATE_CLEARED = 1;
9044
9045    // This packet requires incremental state, such as TracePacketDefaults or
9046    // InternedData, to be parsed correctly. The trace reader should skip this
9047    // packet if incremental state is not valid on this sequence, i.e. if no
9048    // packet with the SEQ_INCREMENTAL_STATE_CLEARED flag has been seen on the
9049    // current |trusted_packet_sequence_id|.
9050    SEQ_NEEDS_INCREMENTAL_STATE = 2;
9051  };
9052  optional uint32 sequence_flags = 13;
9053
9054  // DEPRECATED. Moved to SequenceFlags::SEQ_INCREMENTAL_STATE_CLEARED.
9055  optional bool incremental_state_cleared = 41;
9056
9057  // Default values for fields of later TracePackets emitted on this packet's
9058  // sequence (TracePackets with the same |trusted_packet_sequence_id|).
9059  // It must be reemitted when incremental state is cleared (see
9060  // |incremental_state_cleared|).
9061  // Requires that any future packet emitted on the same sequence specifies
9062  // the SEQ_NEEDS_INCREMENTAL_STATE flag.
9063  // TracePacketDefaults always override the global defaults for any future
9064  // packet on this sequence (regardless of SEQ_NEEDS_INCREMENTAL_STATE).
9065  optional TracePacketDefaults trace_packet_defaults = 59;
9066
9067  // Flag set by the service if, for the current packet sequence (see
9068  // |trusted_packet_sequence_id|), either:
9069  // * this is the first packet, or
9070  // * one or multiple packets were dropped since the last packet that the
9071  //   consumer read from the sequence. This can happen if chunks in the trace
9072  //   buffer are overridden before the consumer could read them when the trace
9073  //   is configured in ring buffer mode.
9074  //
9075  // When packet loss occurs, incrementally emitted data (including interned
9076  // data) on the sequence should be considered invalid up until the next packet
9077  // with SEQ_INCREMENTAL_STATE_CLEARED set.
9078  optional bool previous_packet_dropped = 42;
9079}
9080
9081// End of protos/perfetto/trace/trace_packet.proto
9082
9083// Begin of protos/perfetto/trace/trace.proto
9084
9085message Trace {
9086  repeated TracePacket packet = 1;
9087
9088  // Do NOT add any other field here. This is just a convenience wrapper for
9089  // the use case of a trace being saved to a file. There are other cases
9090  // (streaming) where TracePacket are directly streamed without being wrapped
9091  // in a Trace proto. Nothing should ever rely on the full trace, all the
9092  // logic should be based on TracePacket(s).
9093}
9094
9095// End of protos/perfetto/trace/trace.proto
9096