• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// AUTOGENERATED - DO NOT EDIT
2// ---------------------------
3// This file has been generated by
4// AOSP://external/perfetto/tools/gen_merged_protos
5// merging the perfetto config protos.
6// This fused proto is intended to be copied in:
7//  - Android tree, for statsd.
8//  - Google internal repos.
9
10syntax = "proto2";
11
12package perfetto.protos;
13
14option go_package = "github.com/google/perfetto/perfetto_proto";
15
16// Begin of protos/perfetto/metrics/android/ad_services_metric.proto
17
18// Next: 8
19message AdServicesUiMetric {
20  optional double common_service_initialization_latency = 1;
21  optional double common_service_permission_check_latency = 2;
22  optional double common_service_ux_engine_flow_latency = 3;
23  optional double main_activity_creation_latency = 4;
24  optional double consent_manager_initialization_latency = 5;
25  optional double consent_manager_read_latency = 6;
26  optional double consent_manager_write_latency = 7;
27}
28
29// Next: 2
30message AdServicesAdIdMetric {
31  optional double latency = 1;
32}
33
34// Next: 2
35message AdServicesAppSetIdMetric {
36  optional double latency = 1;
37}
38
39// Next: 5
40message OnDevicePersonalizationMetric {
41  optional double managing_service_initialization_latency = 1;
42  optional double service_delegate_execute_flow_latency = 2;
43  optional double service_delegate_request_surface_package_latency = 3;
44  optional double service_delegate_register_web_trigger_latency = 4;
45}
46
47// Next: 5
48message AdServicesMetric {
49  repeated AdServicesUiMetric ui_metric = 1;
50  repeated AdServicesAdIdMetric ad_id_metric = 2;
51  repeated AdServicesAppSetIdMetric app_set_id_metric = 3;
52  repeated OnDevicePersonalizationMetric odp_metric = 4;
53}
54// End of protos/perfetto/metrics/android/ad_services_metric.proto
55
56// Begin of protos/perfetto/metrics/android/android_anomaly_metric.proto
57
58// Detects outlier scenarios in different Android Systems in a trace. For now, this just
59// detects high binder transaction rates. In the future, there could be others
60// like garbage_collection, CPU, broadcasts, etc.
61message AndroidAnomalyMetric {
62
63  enum Unit {
64      UNIT_UNSPECIFIED = 0;
65      COUNT_PER_SECOND = 1;
66  }
67
68  // For anomalies related to a particular process.
69  message ProcessAnomaly {
70    optional string process_name = 1;
71    optional uint32 pid = 2;
72    optional Unit unit = 3;
73    optional uint32 value = 4;
74  }
75
76  // Binder subsystem outliers with the following aggegations:
77  // 1. Max incoming binder transaction count from each process over a one second sliding window.
78  // 2. Max outgoing binder transaction count from each process over a one second sliding window.
79  message Binder {
80      repeated ProcessAnomaly max_incoming_process_count_per_second = 1;
81      repeated ProcessAnomaly max_outgoing_process_count_per_second = 2;
82  }
83
84  optional Binder binder = 1;
85}
86
87// End of protos/perfetto/metrics/android/android_anomaly_metric.proto
88
89// Begin of protos/perfetto/metrics/android/android_blocking_call.proto
90
91// Blocking call on the main thread.
92message AndroidBlockingCall {
93    // Name of the blocking call
94    optional string name = 1;
95    // Number of times it happened within the CUJ
96    optional int64 cnt = 2;
97    // Total duration within the CUJ
98    optional int64 total_dur_ms = 3;
99    // Maximal duration within the CUJ
100    optional int64 max_dur_ms = 4;
101    // Minimal duration within the CUJ
102    optional int64 min_dur_ms = 5;
103    // Total duration within the CUJ in nanoseconds
104    optional int64 total_dur_ns = 6;
105    // Maximal duration within the CUJ in nanoseconds
106    optional int64 max_dur_ns = 7;
107    // Minimal duration within the CUJ in nanoseconds
108    optional int64 min_dur_ns = 8;
109    // Avg duration within the CUJ
110    optional int64 avg_dur_ms = 9;
111    // Avg duration within the CUJ in nanoseconds
112    optional int64 avg_dur_ns = 10;
113}
114
115// End of protos/perfetto/metrics/android/android_blocking_call.proto
116
117// Begin of protos/perfetto/metrics/android/process_metadata.proto
118
119message AndroidProcessMetadata {
120  // Process name. Usually, cmdline or <package_name>(:<custom_name>)?.
121  optional string name = 1;
122
123  // App uid under which this process runs.
124  optional int64 uid = 2;
125
126  // Android user-id running this process (applicable to multi-user android)
127  optional int64 android_user_id = 10;
128
129  // Package metadata from Android package list.
130  message Package {
131    optional string package_name = 1;
132    optional int64 apk_version_code = 2;
133    optional bool debuggable = 3;
134  }
135
136  // Package that this process belongs to.
137  //
138  // If this process shares its uid (see `packages_for_uid` field), the package
139  // is determined based on the process name and package name. If there is no
140  // match this field is empty.
141  optional Package package = 7;
142
143  // Pid of the process name.
144  optional int64 pid = 9;
145
146  // Whether the process is considered kernel or not
147  optional bool is_kernel_task = 11;
148
149  reserved 3, 4, 5, 6, 8;
150}
151
152// End of protos/perfetto/metrics/android/process_metadata.proto
153
154// Begin of protos/perfetto/metrics/android/android_blocking_calls_cuj_metric.proto
155
156// Blocking calls inside Android CUJs. Shows count and total duration for each.
157message AndroidBlockingCallsCujMetric {
158  repeated Cuj cuj = 1;
159
160  // Next id: 7
161  message Cuj {
162    // ID of the CUJ that is unique within the trace.
163    optional int32 id = 1;
164
165    // Name of the CUJ, extracted from the CUJ jank or latency trace marker.
166    // For example SHADE_EXPAND_COLLAPSE from J<SHADE_EXPAND_COLLAPSE>.
167    optional string name = 2;
168
169    // Details about the process (uid, version, etc)
170    optional AndroidProcessMetadata process = 3;
171
172    // ts of the CUJ trace marker slice, in ns.
173    optional int64 ts = 4;
174
175    // dur of the CUJ trace marker slice, in ns.
176    optional int64 dur = 5;
177
178    // List of blocking calls on the process main thread.
179    repeated AndroidBlockingCall blocking_calls = 6;
180  }
181}
182
183// End of protos/perfetto/metrics/android/android_blocking_calls_cuj_metric.proto
184
185// Begin of protos/perfetto/metrics/android/android_blocking_call_per_frame.proto
186
187// Blocking call per frame on the main thread.
188message AndroidBlockingCallPerFrame {
189    // Name of the blocking call
190    optional string name = 1;
191    // Maximal duration within a frame.
192    optional int64 max_dur_per_frame_ms = 2;
193    // Maximal duration within a frame in nanoseconds
194    optional int64 max_dur_per_frame_ns = 3;
195    // Mean duration within the CUJ
196    optional int64 mean_dur_per_frame_ms = 4;
197    // Mean duration within the CUJ in nanoseconds
198    optional int64 mean_dur_per_frame_ns = 5;
199    // Max count in a frame
200    optional int64 max_cnt_per_frame = 6;
201    // Mean count in a frame
202    optional double mean_cnt_per_frame = 7;
203}
204
205// End of protos/perfetto/metrics/android/android_blocking_call_per_frame.proto
206
207// Begin of protos/perfetto/metrics/android/android_blocking_calls_cuj_per_frame_metric.proto
208
209// Blocking calls per frame inside Android jank CUJs. Shows count and duration for each.
210message AndroidCujBlockingCallsPerFrameMetric {
211  repeated Cuj cuj = 1;
212
213  message Cuj {
214
215    // Name of the CUJ, extracted from the CUJ jank trace marker.
216    // For example SHADE_EXPAND_COLLAPSE from J<SHADE_EXPAND_COLLAPSE>.
217    optional string name = 1;
218
219    optional AndroidProcessMetadata process = 2;
220
221    // List of blocking calls on the process UI thread.
222    // Aggregation is done by CUJ name.
223    repeated AndroidBlockingCallPerFrame blocking_calls = 3;
224  }
225}
226
227// End of protos/perfetto/metrics/android/android_blocking_calls_cuj_per_frame_metric.proto
228
229// Begin of protos/perfetto/metrics/android/android_blocking_calls_unagg.proto
230
231// All blocking calls for a trace. Shows count and total duration for each.
232message AndroidBlockingCallsUnagg {
233  repeated ProcessWithBlockingCalls process_with_blocking_calls = 1;
234
235  message ProcessWithBlockingCalls {
236    // Details about the process (uid, version, etc)
237    optional AndroidProcessMetadata process = 1;
238
239    // List of blocking calls on the process main thread.
240    repeated AndroidBlockingCall blocking_calls = 2;
241  }
242}
243
244// End of protos/perfetto/metrics/android/android_blocking_calls_unagg.proto
245
246// Begin of protos/perfetto/metrics/android/android_boot.proto
247
248// This metric computes how much time processes spend in UNINTERRUPTIBLE_SLEEP
249// state
250message ProcessStateDurations {
251  optional int64 total_dur = 2;
252  optional int64 uninterruptible_sleep_dur = 3;
253}
254
255message AndroidBootMetric {
256  optional ProcessStateDurations system_server_durations = 1;
257  optional ProcessStateDurations systemui_durations = 2;
258  optional ProcessStateDurations launcher_durations = 3;
259  optional ProcessStateDurations gms_durations = 4;
260  // Launcher related boot metrics
261  message LauncherBreakdown {
262    //  reports cold start time of NexusLauncher
263    optional int64 cold_start_dur = 1;
264  }
265  optional LauncherBreakdown launcher_breakdown = 5;
266
267  message ProcessStartAggregation {
268    optional int64 total_start_sum = 1;
269    optional int64 num_of_processes = 2;
270    optional double average_start_time = 3;
271  }
272  message GarbageCollectionAggregation {
273    optional int64 total_gc_count = 1;
274    optional int64 num_of_processes_with_gc = 2;
275    optional int64 num_of_threads_with_gc = 3;
276    optional double avg_gc_duration = 4;
277    optional double avg_running_gc_duration = 5;
278    optional int64 full_gc_count = 6;
279    optional int64 collector_transition_gc_count = 7;
280    optional int64 young_gc_count = 8;
281    optional int64 native_alloc_gc_count = 9;
282    optional int64 explicit_gc_count = 10;
283    optional int64 alloc_gc_count = 11;
284    optional double mb_per_ms_of_gc = 12;
285  }
286  message OomAdjusterTransitionCounts {
287    // name of the item aggregated by. example: process_name,
288    // oom_adjuster_reason.
289    optional string name = 1;
290    // name of previous oom bucket.
291    optional string src_bucket = 2;
292    // name of oom bucket.
293    optional string dest_bucket = 3;
294    // count of transitions
295    optional int64 count = 4;
296  }
297  message OomAdjBucketDurationAggregation {
298    // name of the item aggregated by. example: process_name,
299    // oom_adjuster_reason
300    optional string name = 1;
301    // name of oom bucket.
302    optional string bucket = 2;
303    // Duration of the time in the bucket
304    optional int64 total_dur = 3;
305  }
306  message OomAdjDurationAggregation {
307    optional int64 min_oom_adj_dur = 1;
308    optional int64 max_oom_adj_dur = 2;
309    optional double avg_oom_adj_dur = 3;
310    optional int64 oom_adj_event_count = 4;
311    optional string oom_adj_reason = 5;
312  }
313  message BroadcastCountAggregation {
314    optional string name = 1;
315    optional int64 count = 2;
316  }
317  // Stats for Broadcasts aggregated with duration.
318  message BroadcastDurationAggregation {
319    optional string name = 1;
320    optional double avg_duration = 2;
321    optional int64 max_duration = 3;
322    optional int64 sum_duration = 4;
323}
324  optional ProcessStartAggregation full_trace_process_start_aggregation = 6;
325  optional ProcessStartAggregation post_boot_process_start_aggregation = 7;
326  optional GarbageCollectionAggregation full_trace_gc_aggregation = 8;
327  optional GarbageCollectionAggregation post_boot_gc_aggregation = 9;
328  repeated OomAdjusterTransitionCounts
329      post_boot_oom_adjuster_transition_counts_global = 10;
330  repeated OomAdjusterTransitionCounts
331      post_boot_oom_adjuster_transition_counts_by_process = 11;
332  repeated OomAdjusterTransitionCounts
333      post_boot_oom_adjuster_transition_counts_by_oom_adj_reason = 12;
334  repeated OomAdjBucketDurationAggregation
335      post_boot_oom_adj_bucket_duration_agg_global = 13;
336  repeated OomAdjBucketDurationAggregation
337      post_boot_oom_adj_bucket_duration_agg_by_process = 14;
338  repeated OomAdjDurationAggregation post_boot_oom_adj_duration_agg = 15;
339  repeated BroadcastCountAggregation post_boot_broadcast_process_count_by_intent = 16;
340  repeated BroadcastCountAggregation post_boot_broadcast_count_by_process = 17;
341  repeated BroadcastDurationAggregation post_boot_brodcast_duration_agg_by_intent = 18;
342  repeated BroadcastDurationAggregation post_boot_brodcast_duration_agg_by_process = 19;
343
344}
345
346// End of protos/perfetto/metrics/android/android_boot.proto
347
348// Begin of protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto
349
350message AndroidGarbageCollectionUnaggMetric {
351  message GarbageCollectionEvent {
352    // Name of thread running garbage collection.
353    optional string thread_name = 1;
354    // Name of process running garbage collection.
355    optional string process_name = 2;
356    // Type of garbage collection.
357    optional string gc_type = 3;
358    // Whether gargage collection is mark compact or copying.
359    optional int64 is_mark_compact = 4;
360    // MB reclaimed after garbage collection.
361    optional double reclaimed_mb = 5;
362    // Minimum heap size in MB during garbage collection.
363    optional double min_heap_mb = 6;
364    // Maximum heap size in MB during garbage collection.
365    optional double max_heap_mb = 7;
366    // Memory reclaimed per ms of running time.
367    optional double mb_per_ms_of_running_gc = 8;
368    // Memory reclaimed per ms of wall time.
369    optional double mb_per_ms_of_wall_gc = 9;
370    // Garbage collection wall duration.
371    optional int64 gc_dur = 10;
372    // Garbage collection duration spent executing on CPU.
373    optional int64 gc_running_dur = 11;
374    // Garbage collection duration spent waiting for CPU.
375    optional int64 gc_runnable_dur = 12;
376    // Garbage collection duration spent waiting in the Linux kernel on IO.
377    optional int64 gc_unint_io_dur = 13;
378    // Garbage collection duration spent waiting in the Linux kernel without IO.
379    optional int64 gc_unint_non_io_dur = 14;
380    // Garbage collection duration spent waiting in interruptible sleep.
381    optional int64 gc_int_dur = 15;
382    // ts of the event in trace.
383    optional int64 gc_ts = 16;
384    // pid of the event in trace.
385    optional int64 pid = 17;
386    // tid of the event in trace.
387    optional int64 tid = 18;
388    // monotonic duration of event.
389    optional int64 gc_monotonic_dur = 19;
390    // Details about the process (uid, version, etc)
391    optional AndroidProcessMetadata process = 20;
392    // The number of GCs in this event. Namely 1.
393    optional int64 gc_count = 21;
394  }
395  repeated GarbageCollectionEvent gc_events = 1;
396}
397
398// End of protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto
399
400// Begin of protos/perfetto/metrics/android/app_process_starts_metric.proto
401
402message AndroidAppProcessStartsMetric {
403  // Next id : 4
404  message ProcessStart {
405    optional string process_name = 1;
406    optional string intent = 2;
407    optional string reason = 3;
408    optional int64 proc_start_dur = 4;
409    optional int64 bind_app_dur = 5;
410    optional int64 intent_dur = 6;
411    optional int64 total_dur = 7;
412  }
413  // Provides java process startup information for
414  // all processes starting after Boot completed broadcast in a trace.
415  repeated ProcessStart all_apps = 1;
416  // Provides java process startup information for all
417  // processes started from a broadcast after Boot Complete broadcasts.
418  repeated ProcessStart started_by_broadcast = 2;
419  // Provides java process startup information for all
420  // processes started from a service after Boot Complete broadcasts.
421  repeated ProcessStart started_by_service = 3;
422}
423
424// End of protos/perfetto/metrics/android/app_process_starts_metric.proto
425
426// Begin of protos/perfetto/metrics/android/android_boot_unagg.proto
427
428message AndroidBootUnagg {
429  // Looks at all apps started after boot complete broadcast.
430  optional AndroidAppProcessStartsMetric android_app_process_start_metric = 1;
431  // Looks at all GC that occurs after boot complete broadcast.
432  optional AndroidGarbageCollectionUnaggMetric android_post_boot_gc_metric = 2;
433}
434
435// End of protos/perfetto/metrics/android/android_boot_unagg.proto
436
437// Begin of protos/perfetto/metrics/android/android_broadcasts_metric.proto
438
439  // Provides aggregated information about broadcasts
440  message AndroidBroadcastsMetric {
441    // Next id: 5
442    // Stats for Broadcasts aggregated with count.
443    message BroadcastCountAggregation {
444      optional string name = 1;
445      optional int64 count = 2;
446    }
447    // Stats for Broadcasts aggregated with duration.
448    message BroadcastDurationAggregation {
449      optional string name = 1;
450      optional double avg_duration = 2;
451      optional int64 max_duration = 3;
452      optional int64 sum_duration = 4;
453    }
454    repeated BroadcastCountAggregation process_count_by_intent = 1;
455    repeated BroadcastCountAggregation broadcast_count_by_process = 2;
456    repeated BroadcastDurationAggregation brodcast_duration_agg_by_intent = 3;
457    repeated BroadcastDurationAggregation brodcast_duration_agg_by_process = 4;
458  }
459
460// End of protos/perfetto/metrics/android/android_broadcasts_metric.proto
461
462// Begin of protos/perfetto/metrics/android/android_frame_timeline_metric.proto
463
464message AndroidFrameTimelineMetric {
465  message JankTypeMetric {
466    // The jank type
467    optional string type = 1;
468
469    // The count of frames with this jank type
470    optional int64 total_count = 2;
471
472    // The count of frames with this jank type and present type = PRESENT_UNSPECIFIED
473    optional int64 present_unspecified_count = 3;
474
475    // The count of frames with this jank type and present type = PRESENT_ON_TIME
476    optional int64 present_on_time_count = 4;
477
478    // The count of frames with this jank type and present type = PRESENT_LATE
479    optional int64 present_late_count = 5;
480
481    // The count of frames with this jank type and present type = PRESENT_EARLY
482    optional int64 present_early_count = 6;
483
484    // The count of frames with this jank type and present type = PRESENT_DROPPED
485    optional int64 present_dropped_count = 7;
486
487    // The count of frames with this jank type and present type = PRESENT_UNKNOWN
488    optional int64 present_unknown_count = 8;
489  }
490
491  message ProcessBreakdown {
492    optional AndroidProcessMetadata process = 3;
493
494    optional int64 total_frames = 4;
495    optional int64 missed_frames = 5;
496    optional int64 missed_app_frames = 6;
497    optional int64 missed_sf_frames = 7;
498
499    optional int64 frame_dur_max = 8;
500    optional int64 frame_dur_avg = 9;
501    optional int64 frame_dur_p50 = 10;
502    optional int64 frame_dur_p90 = 11;
503    optional int64 frame_dur_p95 = 12;
504    optional int64 frame_dur_p99 = 13;
505    optional double frame_dur_ms_p50 = 14;
506    optional double frame_dur_ms_p90 = 15;
507    optional double frame_dur_ms_p95 = 16;
508    optional double frame_dur_ms_p99 = 17;
509    optional int64 dropped_frames = 18;
510
511    // Metrics for each jank type in this process
512    repeated JankTypeMetric jank_types = 19;
513
514    reserved 1, 2;
515  }
516
517  optional int64 total_frames = 4;
518  optional int64 missed_app_frames = 5;
519  optional int64 dropped_frames = 6;
520
521  repeated ProcessBreakdown process = 2;
522
523  // Metrics for each jank type globally
524  repeated JankTypeMetric jank_types = 7;
525
526  reserved 1;
527}
528
529
530// End of protos/perfetto/metrics/android/android_frame_timeline_metric.proto
531
532// Begin of protos/perfetto/metrics/android/android_garbage_collection_stats.proto
533
534message AndroidGarbageCollectionStats {
535  message ProcessStats {
536    // The process the stats are associated with.
537    optional AndroidProcessMetadata process = 1;
538    // Megabyte-seconds of heap size across the device, used in the calculation
539    // of heap_size_mb.
540    optional double heap_size_mbs = 2;
541    // Total size of heap allocations across the device on average, in MB.
542    optional double heap_size_mb = 3;
543    // Total number of bytes allocated over the course of the trace.
544    optional double heap_allocated_mb = 4;
545    // Overall rate of heap allocations in MB per second. This gives a sense of
546    // how much allocation activity is going on during the trace.
547    optional double heap_allocation_rate = 5;
548    // Megabyte-seconds of live heap for processes that had GC events.
549    optional double heap_live_mbs = 6;
550    // Megabyte-seconds of total heap for processes that had GC events.
551    optional double heap_total_mbs = 7;
552    // Overall heap utilization. This gives a sense of how aggressive GC is
553    // during this trace.
554    optional double heap_utilization = 8;
555    // CPU time spent running GC. Used in the calculation of gc_running_rate.
556    optional int64 gc_running_dur = 9;
557    // CPU time spent running GC, as a fraction of the duration of the trace.
558    // This gives a sense of the battery cost of GC.
559    optional double gc_running_rate = 10;
560    // A measure of how efficient GC is with respect to cpu, independent of how
561    // aggressively GC is tuned. Larger values indicate more efficient GC, so
562    // larger is better.
563    optional double gc_running_efficiency = 11;
564    // Time GC is running during app startup. Used in the calculation of
565    // gc_during_android_startup_rate.
566    optional int64 gc_during_android_startup_dur = 12;
567    // Time GC is running during app startup, as a fraction of startup time in
568    // the trace. This gives a sense of how much potential interference there
569    // is between GC and application startup.
570    optional double gc_during_android_startup_rate = 13;
571    // A measure of how efficient GC is with regards to gc during application
572    // startup, independent of how aggressively GC is tuned. Larger values
573    // indicate more efficient GC, so larger is better.
574    optional double gc_during_android_startup_efficiency = 14;
575  }
576
577  // The start of the window of time that the stats cover in the trace.
578  optional int64 ts = 1;
579  // The duration of the window of time that the stats cover in the trace.
580  optional int64 dur = 2;
581  // Megabyte-seconds of heap size across the device, used in the calculation
582  // of heap_size_mb.
583  optional double heap_size_mbs = 3;
584  // Total size of heap allocations across the device on average, in MB.
585  optional double heap_size_mb = 4;
586  // Total number of bytes allocated over the course of the trace.
587  optional double heap_allocated_mb = 5;
588  // Overall rate of heap allocations in MB per second. This gives a sense of
589  // how much allocation activity is going on during the trace.
590  optional double heap_allocation_rate = 6;
591  // Megabyte-seconds of live heap for processes that had GC events.
592  optional double heap_live_mbs = 7;
593  // Megabyte-seconds of total heap for processes that had GC events.
594  optional double heap_total_mbs = 8;
595  // Overall heap utilization. This gives a sense of how aggressive GC is
596  // during this trace.
597  optional double heap_utilization = 9;
598  // CPU time spent running GC. Used in the calculation of gc_running_rate.
599  optional int64 gc_running_dur = 10;
600  // CPU time spent running GC, as a fraction of the duration of the trace.
601  // This gives a sense of the battery cost of GC.
602  optional double gc_running_rate = 11;
603  // A measure of how efficient GC is with respect to cpu, independent of how
604  // aggressively GC is tuned. Larger values indicate more efficient GC, so
605  // larger is better.
606  optional double gc_running_efficiency = 12;
607  // Time GC is running during app startup. Used in the calculation of
608  // gc_during_android_startup_rate.
609  optional int64 gc_during_android_startup_dur = 13;
610  // Total startup time in the trace, used to normalize the
611  // gc_during_android_startup_rate.
612  optional int64 total_android_startup_dur = 14;
613  // Time GC is running during app startup, as a fraction of startup time in
614  // the trace. This gives a sense of how much potential interference there
615  // is between GC and application startup.
616  optional double gc_during_android_startup_rate = 15;
617  // A measure of how efficient GC is with regards to gc during application
618  // startup, independent of how aggressively GC is tuned. Larger values
619  // indicate more efficient GC, so larger is better.
620  optional double gc_during_android_startup_efficiency = 16;
621  // Per-process stats.
622  repeated ProcessStats processes = 17;
623}
624
625// End of protos/perfetto/metrics/android/android_garbage_collection_stats.proto
626
627// Begin of protos/perfetto/metrics/android/android_oom_adjuster_metric.proto
628
629message AndroidOomAdjusterMetric {
630  message OomAdjusterTransitionCounts {
631    // name of the item aggregated by. example: process_name,
632    // oom_adjuster_reason.
633    optional string name = 1;
634    // name of previous oom bucket.
635    optional string src_bucket = 2;
636    // name of oom bucket.
637    optional string dest_bucket = 3;
638    // count of transitions
639    optional int64 count = 4;
640  }
641  message OomAdjBucketDurationAggregation {
642    // name of the item aggregated by. example: process_name,
643    // oom_adjuster_reason
644    optional string name = 1;
645    // name of oom bucket.
646    optional string bucket = 2;
647    // Duration of the time in the bucket
648    optional int64 total_dur = 3;
649  }
650  message OomAdjDurationAggregation {
651    optional int64 min_oom_adj_dur = 1;
652    optional int64 max_oom_adj_dur = 2;
653    optional double avg_oom_adj_dur = 3;
654    optional int64 oom_adj_event_count = 4;
655    optional string oom_adj_reason = 5;
656  }
657  repeated OomAdjusterTransitionCounts oom_adjuster_transition_counts_global =
658      1;
659  repeated OomAdjusterTransitionCounts
660      oom_adjuster_transition_counts_by_process = 2;
661  repeated OomAdjusterTransitionCounts
662      oom_adjuster_transition_counts_by_oom_adj_reason = 3;
663  repeated OomAdjBucketDurationAggregation oom_adj_bucket_duration_agg_global =
664      4;
665  repeated OomAdjBucketDurationAggregation
666      oom_adj_bucket_duration_agg_by_process = 5;
667  repeated OomAdjDurationAggregation oom_adj_duration_agg = 6;
668}
669// End of protos/perfetto/metrics/android/android_oom_adjuster_metric.proto
670
671// Begin of protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto
672
673// Blocking calls inside System UI Notifications. Shows count and total duration for each.
674message AndroidSysUINotificationsBlockingCallsMetric {
675  repeated AndroidBlockingCall blocking_calls = 1;
676}
677
678// End of protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto
679
680// Begin of protos/perfetto/metrics/android/anr_metric.proto
681
682 message AndroidAnrMetric {
683  repeated Anr anr = 1;
684
685  // Next id: 12
686  message Anr {
687    // UUID that identifies the ANR.
688    optional string error_id = 1;
689
690    // Name of the process that ANRed.
691    optional string process_name = 2;
692
693    // PID of the ANRing process.
694    optional int32 pid = 3;
695
696    // ANR subject line.
697    optional string subject = 4;
698
699    // Timestamp of the ANR in the trace.
700    optional int64 ts = 5;
701  }
702}
703// End of protos/perfetto/metrics/android/anr_metric.proto
704
705// Begin of protos/perfetto/metrics/android/auto_metric.proto
706
707// Metrics for Multiuser events, such as switching users.
708message AndroidAutoMultiuserMetric {
709  message EventData {
710    // Id of the user the system has been switched to
711    optional int32 user_id = 1;
712
713    // The end event name for which the duration_ms is measured
714    optional string start_event = 2;
715
716    // The end event name for which the duration_ms is measured
717    optional string end_event = 3;
718
719    // Duration of the event (in milliseconds).
720    optional int64 duration_ms = 4;
721
722    // Previous user resource usage info during user switch
723    message UserData {
724      // Id of the user the system has been switched from
725      optional int32 user_id = 1;
726
727      optional int64 total_cpu_time_ms = 2;
728
729      optional int64 total_memory_usage_kb = 3;
730    }
731
732    optional UserData previous_user_info = 5;
733  }
734
735  // Metrics for a user switch.
736  repeated EventData user_switch = 1;
737}
738
739// End of protos/perfetto/metrics/android/auto_metric.proto
740
741// Begin of protos/perfetto/metrics/android/batt_metric.proto
742
743message AndroidBatteryMetric {
744  message BatteryCounters {
745    // Timestamp measured from boot time [ns].
746    optional int64 timestamp_ns = 1;
747    // Fields 2-5 are the same as in BatteryCounters proto in TracePacket.
748    optional double charge_counter_uah = 2;
749    optional float capacity_percent = 3;
750    optional double current_ua = 4;
751    optional double current_avg_ua = 5;
752    optional double voltage_uv = 6;
753  }
754
755  message BatteryAggregates {
756    // Field numbers for these 3 == the int values from Android
757    optional int64 total_screen_off_ns = 1;
758    optional int64 total_screen_on_ns = 2;
759    optional int64 total_screen_doze_ns = 3;
760    // Total time a wakelock was held
761    optional int64 total_wakelock_ns = 4;
762    // Amount of time the device was suspended. Depends on the ftrace source
763    // "power/suspend_resume".
764    optional int64 sleep_ns = 5;
765    optional int64 sleep_screen_off_ns = 6;
766    optional int64 sleep_screen_on_ns = 7;
767    optional int64 sleep_screen_doze_ns = 8;
768    // Average power over the duration of the trace.
769    optional double avg_power_mw = 9;
770    // Average power from charge difference at the start and end of the trace.
771    optional double avg_power_from_charge_diff_mw = 10;
772  }
773
774  // Period of time during the trace that the device went to sleep completely.
775  message SuspendPeriod {
776    optional int64 timestamp_ns = 1;
777    optional int64 duration_ns = 2;
778  }
779
780  // Battery counters info for each ts of the trace. This should only be
781  // extracted for short traces.
782  repeated BatteryCounters battery_counters = 1;
783
784  optional BatteryAggregates battery_aggregates = 2;
785
786  repeated SuspendPeriod suspend_period = 3;
787}
788
789// End of protos/perfetto/metrics/android/batt_metric.proto
790
791// Begin of protos/perfetto/metrics/android/binder_metric.proto
792
793// This metric provides the following:
794// 1. Per-process Binder statistics for traces with binder_driver enabled.
795//    Specifically, transactions are categorized and counted
796// 2. Unaggregated binder txn durations with per-txn aggregated thread state and
797// blocked function
798//    durations
799message AndroidBinderMetric {
800  message PerProcessBreakdown {
801    optional string process_name = 1;
802    optional uint32 pid = 2;
803    optional string slice_name = 3;
804    optional uint32 count = 4;
805  }
806
807  // Next field id: 31
808  message UnaggregatedTxnBreakdown {
809    // General
810    optional string aidl_name = 1;
811    optional int64 aidl_ts = 22;
812    optional int64 aidl_dur = 23;
813    optional bool is_sync = 21;
814    // Client
815    // Removed: was binder_txn_id
816    reserved 2;
817    optional string client_process = 3;
818    optional string client_thread = 4;
819    optional bool is_main_thread = 5;
820    optional int64 client_ts = 6;
821    optional int64 client_dur = 7;
822    optional int64 client_monotonic_dur = 28;
823    optional int64 client_oom_score = 19;
824    optional int64 client_package_version_code = 24;
825    optional bool is_client_package_debuggable = 25;
826    // Server
827    // Removed: was binder_reply_id
828    reserved 8;
829    optional string server_process = 9;
830    optional string server_thread = 10;
831    optional int64 server_ts = 11;
832    optional int64 server_dur = 12;
833    optional int64 server_monotonic_dur = 29;
834    optional int64 server_oom_score = 20;
835    optional int64 server_package_version_code = 26;
836    optional bool is_server_package_debuggable = 27;
837    // Aggregations
838    repeated ThreadStateBreakdown thread_states = 13;
839    repeated BlockedFunctionBreakdown blocked_functions = 14;
840    repeated LogicalReasonBreakdown logical_reasons = 31;
841
842    optional uint32 client_tid = 15;
843    optional uint32 server_tid = 16;
844
845    optional uint32 client_pid = 17;
846    optional uint32 server_pid = 18;
847  }
848
849  message ThreadStateBreakdown {
850    optional string thread_state_type = 1;
851    optional string thread_state = 2;
852    optional int64 thread_state_dur = 3;
853    optional int64 thread_state_count = 4;
854  }
855
856  message BlockedFunctionBreakdown {
857    optional string thread_state_type = 1;
858    optional string blocked_function = 2;
859    optional int64 blocked_function_dur = 3;
860    optional int64 blocked_function_count = 4;
861  }
862
863  message LogicalReasonBreakdown {
864    optional string thread_state_type = 1;
865    optional string reason = 2;
866    optional int64 reason_dur = 3;
867  }
868
869  repeated PerProcessBreakdown process_breakdown = 1;
870  repeated UnaggregatedTxnBreakdown unaggregated_txn_breakdown = 2;
871}
872
873// End of protos/perfetto/metrics/android/binder_metric.proto
874
875// Begin of protos/perfetto/metrics/android/camera_metric.proto
876
877message AndroidCameraMetric {
878  message Counter {
879    optional double min = 1;
880    optional double max = 2;
881    optional double avg = 3;
882  }
883
884  // Counter for the sum of DMA and RSS across GCA, cameraserver
885  // and HAL. This provides a single number for the memory
886  // pressure using the camera is putting on the rest of the
887  // system.
888  //
889  // Note: this number assumes that all DMA pressure is coming
890  // from the camera as this is usually a pretty good
891  // approximation. Being more accurate here would increase the
892  // complexity of the metric significantly.
893  //
894  // Note: if there are multiple GCA/cameraserver/HAL processes
895  // in the trace, this metric will simply take the latest
896  // one in the trace and ignore the others.
897  optional Counter gc_rss_and_dma = 1;
898}
899
900// End of protos/perfetto/metrics/android/camera_metric.proto
901
902// Begin of protos/perfetto/metrics/android/camera_unagg_metric.proto
903
904message AndroidCameraUnaggregatedMetric {
905  message Value {
906    optional int64 ts = 1;
907    optional double gca_rss_val = 2;
908    optional double hal_rss_val = 3;
909    optional double cameraserver_rss_val = 4;
910    optional double dma_val = 5;
911    optional double value = 6;
912  }
913
914  // Timeseries for the sum of DMA and RSS across GCA, cameraserver
915  // and HAL. This provides a single number for the memory
916  // pressure using the camera is putting on the rest of the
917  // system.
918  //
919  // Note: this number assumes that all DMA pressure is coming
920  // from the camera as this is usually a pretty good
921  // approximation. Being more accurate here would increase the
922  // complexity of the metric significantly.
923  //
924  // Note: if there are multiple GCA/cameraserver/HAL processes
925  // in the trace, this metric will simply take the latest
926  // one in the trace and ignore the others.
927  repeated Value gc_rss_and_dma = 1;
928}
929
930// End of protos/perfetto/metrics/android/camera_unagg_metric.proto
931
932// Begin of protos/perfetto/metrics/android/cpu_metric.proto
933
934message AndroidCpuMetric {
935  // Next id: 6
936  message Metrics {
937    // CPU megacycles (i.e. cycles divided by 1e6).
938    optional int64 mcycles = 1;
939
940    // Total time the thread was running for this breakdown in
941    // nanoseconds.
942    optional int64 runtime_ns = 2;
943
944    // Min/max/average CPU frequency weighted by the time the CPU was
945    // running at each frequency in this breakdown.
946    optional int64 min_freq_khz = 3;
947    optional int64 max_freq_khz = 4;
948    optional int64 avg_freq_khz = 5;
949  }
950
951  // Next id: 7
952  message CoreData {
953    optional uint32 id = 1;
954    optional Metrics metrics = 6;
955
956    reserved 2 to 5;
957  }
958
959  // Next id: 3
960  message CoreTypeData {
961    optional string type = 1;
962    optional Metrics metrics = 2;
963  }
964
965  // Next id: 7
966  message Thread {
967    optional string name = 1;
968    optional Metrics metrics = 4;
969
970    // Breakdowns of above metrics.
971    repeated CoreData core = 2;
972    repeated CoreTypeData core_type = 5;
973
974    reserved 3;
975  }
976
977  // Next id: 8
978  message Process {
979    optional string name = 1;
980    optional AndroidProcessMetadata process = 8;
981    optional Metrics metrics = 4;
982
983    // Breakdowns of above metrics.
984    repeated Thread threads = 6;
985    repeated CoreData core = 7;
986    repeated CoreTypeData core_type = 5;
987
988    reserved 3;
989  }
990
991  repeated Process process_info = 1;
992}
993
994// End of protos/perfetto/metrics/android/cpu_metric.proto
995
996// Begin of protos/perfetto/metrics/android/codec_metrics.proto
997
998// These metrices collects various function and thread
999// usage within androd's codec framework. This can give an
1000// idea about performance and cpu usage when using codec
1001// framework
1002message AndroidCodecMetrics {
1003
1004  // profile details in messages
1005  message Detail {
1006    // was thread_name
1007    reserved 1;
1008    // total time
1009    optional int64 total_cpu_ns = 2;
1010    // CPU time ( time 'Running' on cpu)
1011    optional int64 running_cpu_ns = 3;
1012    // avg running time for the trace duration
1013    optional int64 avg_running_cpu_ns = 9;
1014    // Total CPU cycles
1015    optional int64 total_cpu_cycles = 4;
1016    // avg CPU cycles per call
1017    optional int64 avg_cpu_cycles = 8;
1018    // avg time for this slice type
1019    optional int64 avg_time_ns = 5;
1020    optional int32 count = 6;
1021    message Latency {
1022      optional int64 max_us = 1;
1023      optional int64 min_us = 2;
1024      optional int64 avg_us = 3;
1025      optional int64 agg_us = 4;
1026      optional uint32 count = 5;
1027    }
1028    optional Latency self = 7;
1029  }
1030
1031  // These are traces and could indicate framework queue latency
1032  // buffer-packing, buffer-preprocess, buffer post-process
1033  // latency etc. These metrics are monitored to track quality.
1034  // Same message can come from different
1035  // processes.
1036  message CodecFunction {
1037    // codec string
1038    optional string codec_string = 1;
1039    message Process {
1040      optional string name = 1;
1041      message Thread {
1042        optional string name = 1;
1043        optional Detail detail = 2;
1044      }
1045      optional Thread thread = 2;
1046    }
1047    optional Process process = 2;
1048  }
1049
1050  // This message can indicate overall cpu
1051  // utilization of codec framework threads.
1052  message CpuUsage {
1053    // name of process using codec framework
1054    optional string process_name = 1;
1055    message ThreadInfo {
1056      // name of the codec thread
1057      optional string name = 1;
1058      message Details {
1059        // total cpu usage of the codec thread
1060        optional int64 thread_cpu_ns = 1;
1061        // can be number of codec framework thread
1062        optional uint32 num_threads = 2;
1063        // core type data info used by codec thread
1064        repeated AndroidCpuMetric.CoreTypeData core_data = 3;
1065      }
1066      optional Details info = 2;
1067    }
1068    optional ThreadInfo thread = 2;
1069    // was thread_cpu_us
1070    reserved 3;
1071  }
1072
1073  // Rail details
1074  message Rail {
1075    // name of rail
1076    optional string name = 1;
1077    // energy and power details of this rail
1078    message Info {
1079      // energy from this rail for codec use
1080      optional double energy = 1;
1081      // power consumption in this rail for codec use
1082      optional double power_mw = 2;
1083    }
1084    optional Info info = 2;
1085  }
1086
1087  // have the energy usage for the codec running time
1088  message Energy {
1089    // total energy taken by the system during this time
1090    optional double total_energy = 1;
1091    // total time for this energy is calculated
1092    optional int64 duration = 2;
1093    //  for this session
1094    optional double power_mw = 3;
1095    // enery breakdown by subsystem
1096    repeated Rail rail = 4;
1097  }
1098
1099  repeated CpuUsage cpu_usage = 1;
1100  repeated CodecFunction codec_function = 2;
1101  optional Energy energy = 3;
1102}
1103
1104// End of protos/perfetto/metrics/android/codec_metrics.proto
1105
1106// Begin of protos/perfetto/metrics/android/display_metrics.proto
1107
1108message AndroidDisplayMetrics {
1109  // Stat that reports the number of duplicate frames submitted
1110  // to the display for rendering. That is frames that have the same
1111  // pixels values but where still submitted. It is tracked based on
1112  // comparing the MISR of the current frame vs previous frame.
1113  optional uint32 total_duplicate_frames = 1;
1114
1115  // Stat reports whether there is any duplicate_frames tracked
1116  optional uint32 duplicate_frames_logged = 2;
1117
1118  // Stat that reports the number of dpu underrrun occurs count.
1119  optional uint32 total_dpu_underrun_count = 3;
1120
1121
1122  message RefreshRateStat {
1123    // The refresh rate value (the number of frames per second)
1124    optional uint32 refresh_rate_fps = 1;
1125
1126    // Calculate the number of refresh rate switches to this fps
1127    optional uint32 count = 2;
1128
1129    // Calculate the total duration of refresh rate stays at this fps
1130    optional double total_dur_ms = 3;
1131
1132    // Calculate the average duration of refresh rate stays at this fps
1133    optional double avg_dur_ms = 4;
1134  }
1135
1136  // Calculate the total number of refresh rate changes
1137  optional uint32 refresh_rate_switches = 4;
1138
1139  // The statistics for each refresh rate value
1140  repeated RefreshRateStat refresh_rate_stats = 5;
1141
1142  // Stats to measure the runtime of updating the power state in
1143  // DisplayPowerController
1144  message UpdatePowerState {
1145    optional uint32 avg_runtime_micro_secs = 2;
1146
1147    // Removed: avg_runtime_ms
1148    reserved 1;
1149  }
1150
1151  optional UpdatePowerState update_power_state = 6;
1152}
1153
1154// End of protos/perfetto/metrics/android/display_metrics.proto
1155
1156// Begin of protos/perfetto/metrics/android/dma_heap_metric.proto
1157
1158// dma-buf heap memory stats on Android.
1159message AndroidDmaHeapMetric {
1160  message ProcessStats {
1161    // process that either directly or indirectly allocated the buffers
1162    optional string process_name = 1;
1163    // Bytes allocated but not freed during this trace
1164    optional int32 delta_bytes = 2;
1165  }
1166
1167    optional double avg_size_bytes = 1;
1168    optional double min_size_bytes = 2;
1169    optional double max_size_bytes = 3;
1170
1171    // Total allocation size.
1172    // Essentially the sum of positive allocs.
1173    optional double total_alloc_size_bytes = 4;
1174
1175    // Total delta size (bytes allocated but not freed during the trace)
1176    optional int32 total_delta_bytes = 5;
1177    repeated ProcessStats process_stats = 6;
1178}
1179
1180// End of protos/perfetto/metrics/android/dma_heap_metric.proto
1181
1182// Begin of protos/perfetto/metrics/android/dvfs_metric.proto
1183
1184message AndroidDvfsMetric {
1185
1186  message BandStat {
1187    // Operating frequency
1188    optional int32 freq_value = 1;
1189
1190    // Percentage of duration in this operating frequency compared to all frequencies
1191    optional double percentage = 2;
1192
1193    // Total duration in ns when the state was in this operating frequency
1194    optional int64 duration_ns = 3;
1195  }
1196
1197  message FrequencyResidency {
1198    // Frequency representative name
1199    optional string freq_name = 1;
1200    // Each band statistics meta
1201    repeated BandStat band_stat = 2;
1202  }
1203
1204  // Frequency residency metrics from clock_set_rate ftrace event.
1205  repeated FrequencyResidency freq_residencies = 1;
1206}
1207
1208// End of protos/perfetto/metrics/android/dvfs_metric.proto
1209
1210// Begin of protos/perfetto/metrics/android/fastrpc_metric.proto
1211
1212// fastrpc memory stats on Android.
1213message AndroidFastrpcMetric {
1214  message Subsystem {
1215    optional string name = 1;
1216    optional double avg_size_bytes = 2;
1217    optional double min_size_bytes = 3;
1218    optional double max_size_bytes = 4;
1219
1220    // Total allocation size.
1221    // Essentially the sum of positive allocs.
1222    optional double total_alloc_size_bytes = 5;
1223  }
1224
1225  repeated Subsystem subsystem = 1;
1226}
1227
1228// End of protos/perfetto/metrics/android/fastrpc_metric.proto
1229
1230// Begin of protos/perfetto/metrics/android/g2d_metric.proto
1231
1232message G2dMetrics {
1233  message G2dInstance {
1234    // G2d name.
1235    optional string name = 1;
1236
1237    optional uint32 frame_count = 5;
1238    optional uint32 error_count = 6;
1239
1240    optional double max_dur_ms = 7;
1241    optional double min_dur_ms = 8;
1242    optional double avg_dur_ms = 9;
1243
1244    // Removed: was int64 versions of max_dur_ns, min_dur_ns and avg_dur_ns.
1245    reserved 2 to 4;
1246  }
1247  message G2dMetric {
1248    // G2D Metric for each G2D Instance.
1249    repeated G2dInstance instances = 1;
1250
1251    // the number of frames processed by G2D
1252    optional uint32 frame_count = 5;
1253    // the number of error events
1254    optional uint32 error_count = 6;
1255
1256    // max/min/avg G2d frame durations for all instances.
1257    optional double max_dur_ms = 7;
1258    optional double min_dur_ms = 8;
1259    optional double avg_dur_ms = 9;
1260
1261    // Removed: was int64 versions of max_dur_ns, min_dur_ns and avg_dur_ns.
1262    reserved 2 to 4;
1263  }
1264
1265  optional G2dMetric g2d_hw = 1;
1266  optional G2dMetric g2d_sw = 2;
1267}
1268
1269// End of protos/perfetto/metrics/android/g2d_metric.proto
1270
1271// Begin of protos/perfetto/metrics/android/gpu_metric.proto
1272
1273message AndroidGpuMetric {
1274  message Process {
1275    // Process name.
1276    optional string name = 1;
1277
1278    // max/min/avg GPU memory used by this process.
1279    optional int64 mem_max = 2;
1280    optional int64 mem_min = 3;
1281    optional int64 mem_avg = 4;
1282  }
1283
1284  // GPU metric for processes using GPU.
1285  repeated Process processes = 1;
1286
1287  // max/min/avg GPU memory used by the entire system.
1288  optional int64 mem_max = 2;
1289  optional int64 mem_min = 3;
1290  optional int64 mem_avg = 4;
1291
1292  message FrequencyMetric {
1293    // Identifier for GPU in a multi-gpu device.
1294    optional uint32 gpu_id = 1;
1295
1296    // max/min/avg GPU frequency for this gpu_id
1297    // the calculation of avg is weighted by the duration of each frequency
1298    optional int64 freq_max = 2;
1299    optional int64 freq_min = 3;
1300    optional double freq_avg = 4;
1301
1302    message MetricsPerFrequency {
1303      // Used frequency
1304      optional int64 freq = 1;
1305
1306      // Total duration in ms when the state of GPU was in this frequency
1307      optional double dur_ms = 2;
1308
1309      // Percentage of duration in this frequency compared to all frequencies
1310      // in this gpu_id
1311      optional double percentage = 3;
1312    }
1313
1314    // Metrics for each used GPU frequency
1315    repeated MetricsPerFrequency used_freqs = 5;
1316  }
1317
1318  // GPU frequency metric for each gpu_id
1319  repeated FrequencyMetric freq_metrics = 5;
1320}
1321
1322// End of protos/perfetto/metrics/android/gpu_metric.proto
1323
1324// Begin of protos/perfetto/metrics/android/hwcomposer.proto
1325
1326message AndroidHwcomposerMetrics {
1327  // Counts the number of composition total layers in the trace. (non-weighted average)
1328  optional double composition_total_layers = 1;
1329
1330  // Counts the number of composition dpu layers in the trace. (non-weighted average)
1331  optional double composition_dpu_layers = 2;
1332
1333  // Counts the number of composition gpu layers in the trace. (non-weighted average)
1334  optional double composition_gpu_layers = 3;
1335
1336  // Counts the number of composition dpu cached layers in the trace. (non-weighted average)
1337  optional double composition_dpu_cached_layers = 4;
1338
1339  // Counts the number of composition surfaceflinger cached layers in the trace.
1340  // (non-weighted average)
1341  optional double composition_sf_cached_layers = 5;
1342
1343  // Counts the number of composition rounded corner decoration layers in the trace.
1344  // (non-weighted average)
1345  optional double composition_rcd_layers = 15;
1346
1347  // Counts how many times validateDisplay is skipped.
1348  optional int32 skipped_validation_count = 6;
1349
1350  // Counts how many times validateDisplay cannot be skipped.
1351  optional int32 unskipped_validation_count = 7;
1352
1353  // Counts how many times validateDisplay is already separated from presentDisplay
1354  // since the beginning.
1355  optional int32 separated_validation_count = 8;
1356
1357  // Counts how many unhandled validation cases which might be caused by errors.
1358  optional int32 unknown_validation_count = 9;
1359
1360  // the average of overall hwcomposer execution time.
1361  optional double avg_all_execution_time_ms = 10;
1362
1363  // the average of hwcomposer execution time for skipped validation cases.
1364  optional double avg_skipped_execution_time_ms = 11;
1365
1366  // the average of hwcomposer execution time for unskipped validation cases.
1367  optional double avg_unskipped_execution_time_ms = 12;
1368
1369  // the average of hwcomposer execution time for separated validation cases.
1370  optional double avg_separated_execution_time_ms = 13;
1371
1372  message DpuVoteMetrics {
1373    // the thread ID that handles this track
1374    optional uint32 tid = 1;
1375
1376    // the weighted average of DPU Vote Clock
1377    optional double avg_dpu_vote_clock = 2;
1378
1379    // the weighted average of DPU Vote Avg Bandwidth
1380    optional double avg_dpu_vote_avg_bw = 3;
1381
1382    // the weighted average of DPU Vote Peak Bandwidth
1383    optional double avg_dpu_vote_peak_bw = 4;
1384
1385    // the weighted average of DPU Vote RT (Real Time) Bandwidth
1386    optional double avg_dpu_vote_rt_bw = 5;
1387  }
1388
1389  // DPU Vote Metrics for each thread track
1390  repeated DpuVoteMetrics dpu_vote_metrics = 14;
1391
1392  message MetricsPerDisplay {
1393    // Display ID in HWC
1394    optional string display_id = 1;
1395
1396    // Counts the number of composition total layers in the trace. (non-weighted average)
1397    optional double composition_total_layers = 2;
1398
1399    // Counts the number of composition dpu layers in the trace. (non-weighted average)
1400    optional double composition_dpu_layers = 3;
1401
1402    // Counts the number of composition gpu layers in the trace. (non-weighted average)
1403    optional double composition_gpu_layers = 4;
1404
1405    // Counts the number of composition dpu cached layers in the trace. (non-weighted average)
1406    optional double composition_dpu_cached_layers = 5;
1407
1408    // Counts the number of composition surfaceflinger cached layers in the trace.
1409    // (non-weighted average)
1410    optional double composition_sf_cached_layers = 6;
1411
1412    // Counts the number of composition rounded corner decoration layers in the trace.
1413    // (non-weighted average)
1414    optional double composition_rcd_layers = 7;
1415
1416    // Counts how many times validateDisplay is skipped.
1417    optional int32 skipped_validation_count = 8;
1418
1419    // Counts how many times validateDisplay cannot be skipped.
1420    optional int32 unskipped_validation_count = 9;
1421
1422    // Counts how many times validateDisplay is already separated from presentDisplay
1423    // since the beginning.
1424    optional int32 separated_validation_count = 10;
1425
1426    // Counts how many unhandled validation cases which might be caused by errors.
1427    optional int32 unknown_validation_count = 11;
1428
1429    // the average of overall hwcomposer execution time.
1430    optional double avg_all_execution_time_ms = 12;
1431
1432    // the average of hwcomposer execution time for skipped validation cases.
1433    optional double avg_skipped_execution_time_ms = 13;
1434
1435    // the average of hwcomposer execution time for unskipped validation cases.
1436    optional double avg_unskipped_execution_time_ms = 14;
1437
1438    // the average of hwcomposer execution time for separated validation cases.
1439    optional double avg_separated_execution_time_ms = 15;
1440  }
1441
1442  repeated MetricsPerDisplay metrics_per_display = 16;
1443}
1444
1445// End of protos/perfetto/metrics/android/hwcomposer.proto
1446
1447// Begin of protos/perfetto/metrics/android/hwui_metric.proto
1448
1449// Android HWUI graphics performance and graphics memory usage metrics.
1450message ProcessRenderInfo {
1451  // Name of the package launched
1452  optional string process_name = 1;
1453
1454  // CPU time spent on RenderThread in milliseconds.
1455  optional int64 rt_cpu_time_ms = 2;
1456
1457  // Number of frames drawn on RenderThread, followed by max/min/avg CPU time to draw a frame
1458  // in nanoseconds.
1459  optional uint32 draw_frame_count = 3;
1460  optional int64 draw_frame_max = 4;
1461  optional int64 draw_frame_min = 5;
1462  optional double draw_frame_avg = 6;
1463
1464  // Number of GPU commands flushes and max/min/avg time per flush in nanoseconds.
1465  optional uint32 flush_count = 7;
1466  optional int64 flush_max = 8;
1467  optional int64 flush_min = 9;
1468  optional double flush_avg = 10;
1469
1470  // Number of View tree preparation counts and max/min/avg time to traverse the tree in
1471  // nanoseconds.
1472  optional uint32 prepare_tree_count = 11;
1473  optional int64 prepare_tree_max = 12;
1474  optional int64 prepare_tree_min = 13;
1475  optional double prepare_tree_avg = 14;
1476
1477  // Number of times the GPU rendered a frame and max/min/avg time for GPU to finish rendering in
1478  // in nanoseconds.
1479  optional uint32 gpu_completion_count = 15;
1480  optional int64 gpu_completion_max = 16;
1481  optional int64 gpu_completion_min = 17;
1482  optional double gpu_completion_avg = 18;
1483
1484  // Number of times a frame was recorded/serialized in a display list on the UI thread with
1485  // max/min/avg time in nanoseconds.
1486  optional uint32 ui_record_count = 19;
1487  optional int64 ui_record_max = 20;
1488  optional int64 ui_record_min = 21;
1489  optional double ui_record_avg = 22;
1490
1491  // number of unique shader programs that were used to render frames, followed by total and average
1492  // times to prepare a shader in nanoseconds.
1493  optional uint32 shader_compile_count = 23;
1494  optional int64 shader_compile_time = 24;
1495  optional double shader_compile_avg = 25;
1496  // number of shader programs loaded from the disk cache, followed by total time and average time
1497  // to prepare a shader in nanoseconds.
1498  optional uint32 cache_hit_count = 26;
1499  optional int64 cache_hit_time = 27;
1500  optional double cache_hit_avg = 28;
1501  // number of shader programs compiled/linked, followed by total time and average time to prepare
1502  // a shader in nanoseconds.
1503  optional uint32 cache_miss_count = 29;
1504  optional int64 cache_miss_time = 30;
1505  optional double cache_miss_avg = 31;
1506
1507  // max/min/avg CPU memory used for graphics by HWUI at the end of a frame.
1508  optional int64 graphics_cpu_mem_max = 32;
1509  optional int64 graphics_cpu_mem_min = 33;
1510  optional double graphics_cpu_mem_avg = 34;
1511
1512  // max/min/avg GPU memory used by HWUI at the end of a frame excluding textures.
1513  optional int64 graphics_gpu_mem_max = 35;
1514  optional int64 graphics_gpu_mem_min = 36;
1515  optional double graphics_gpu_mem_avg = 37;
1516
1517  // max/min/avg memory used for GPU textures by HWUI at the end of a frame.
1518  optional int64 texture_mem_max = 38;
1519  optional int64 texture_mem_min = 39;
1520  optional double texture_mem_avg = 40;
1521
1522  // max/min/avg memory used by HWUI at the end of a frame. This is a sum of previous 3 categories.
1523  optional int64 all_mem_max = 41;
1524  optional int64 all_mem_min = 42;
1525  optional double all_mem_avg = 43;
1526}
1527
1528message AndroidHwuiMetric {
1529  //  HWUI metrics for processes that have a RenderThread.
1530  repeated ProcessRenderInfo process_info = 1;
1531}
1532
1533// End of protos/perfetto/metrics/android/hwui_metric.proto
1534
1535// Begin of protos/perfetto/metrics/android/io_metric.proto
1536
1537// Measure Android IO stats in a trace.
1538// Note: This is an aggregated metric, for unaggregated metrics look at
1539// AndroidIoUnaggregated in io_unagg_metric.proto.
1540message AndroidIo {
1541  // Next id: 3
1542  // Stats for Counters in an f2fs file system.
1543  // Counters are available for various operations.
1544  message F2fsCounterStats {
1545    optional string name = 1;
1546    optional double max = 2;
1547    optional double sum = 3;
1548    optional double min = 5;
1549    optional int64 dur = 6;
1550    optional int64 count = 7;
1551    optional double avg = 8;
1552  }
1553  // Aggregated stats for write operations in an f2fs file system.
1554  message F2fsWriteStats {
1555    optional int64 total_write_count = 1;
1556    optional int64 distinct_processes = 2;
1557    optional int64 total_bytes_written = 3;
1558    optional int64 distinct_device_count = 4;
1559    optional int64 distinct_inode_count = 5;
1560    optional int64 distinct_thread_count = 6;
1561  }
1562  repeated F2fsCounterStats f2fs_counter_stats = 1;
1563  repeated F2fsWriteStats f2fs_write_stats = 2;
1564}
1565
1566// End of protos/perfetto/metrics/android/io_metric.proto
1567
1568// Begin of protos/perfetto/metrics/android/io_unagg_metric.proto
1569
1570// IO metrics on Android in unaggregated form.
1571// Note: this generates a lot of data so should not be requested unless it
1572// is clear that this data is necessary.
1573message AndroidIoUnaggregated {
1574    // Next id: 2
1575    message F2fsWriteUnaggreagatedStat {
1576      optional uint32 tid = 1;
1577      optional string thread_name = 2;
1578      optional uint32 pid = 3;
1579      optional string process_name = 4;
1580      optional int64 ino = 5;
1581      optional int64 dev = 6;
1582    }
1583    // F2fs write stats which are grouped by thread and inode.
1584    repeated F2fsWriteUnaggreagatedStat f2fs_write_unaggregated_stats = 1;
1585}
1586// End of protos/perfetto/metrics/android/io_unagg_metric.proto
1587
1588// Begin of protos/perfetto/metrics/android/ion_metric.proto
1589
1590// ion memory stats on Android.
1591message AndroidIonMetric {
1592  message Buffer {
1593    optional string name = 1;
1594    optional double avg_size_bytes = 2;
1595    optional double min_size_bytes = 3;
1596    optional double max_size_bytes = 4;
1597
1598    // Total allocation size.
1599    // Essentially the sum of positive allocs (-> new buffers).
1600    optional double total_alloc_size_bytes = 5;
1601  }
1602
1603  repeated Buffer buffer = 1;
1604}
1605
1606// End of protos/perfetto/metrics/android/ion_metric.proto
1607
1608// Begin of protos/perfetto/metrics/android/irq_runtime_metric.proto
1609
1610// measure max IRQ runtime and IRQ tasks running over threshold.
1611message AndroidIrqRuntimeMetric {
1612  message IrqSlice {
1613    // IRQ name
1614    optional string irq_name = 1;
1615    // timestamp
1616    optional int64 ts = 2;
1617    // runtime of IRQ task
1618    optional int64 dur = 3;
1619  }
1620  message ThresholdMetric {
1621    // Threshold value
1622    optional string threshold = 1;
1623    // over threshold count
1624    optional int64 over_threshold_count = 2;
1625    // anomaly ratio (over threshold count / total count)
1626    optional double anomaly_ratio= 3;
1627  }
1628  message IrqRuntimeMetric {
1629    // max runtime of IRQ tasks
1630    optional int64 max_runtime = 1;
1631    // total IRQ tasks
1632    optional int64 total_count = 2;
1633    // over threshold metric
1634    optional ThresholdMetric threshold_metric = 3;
1635    // information for top 10 IRQ tasks
1636    repeated IrqSlice longest_irq_slices = 4;
1637  }
1638
1639  // metrics for hardirq and softirq
1640  optional IrqRuntimeMetric hw_irq = 1;
1641  optional IrqRuntimeMetric sw_irq = 2;
1642}
1643
1644
1645// End of protos/perfetto/metrics/android/irq_runtime_metric.proto
1646
1647// Begin of protos/perfetto/metrics/android/jank_cuj_metric.proto
1648
1649message AndroidJankCujMetric {
1650  repeated Cuj cuj = 1;
1651
1652  // Next id: 12
1653  message Cuj {
1654    // ID of the CUJ that is unique within the trace.
1655    optional int32 id = 1;
1656
1657    // Name of the CUJ, extracted from the CUJ trace marker.
1658    // For example SHADE_EXPAND_COLLAPSE from J<SHADE_EXPAND_COLLAPSE>.
1659    optional string name = 2;
1660
1661    // Details about the process (uid, version, etc)
1662    optional AndroidProcessMetadata process = 3;
1663
1664    // ts of the CUJ trace marker slice.
1665    optional int64 ts = 4;
1666
1667    // dur of the CUJ trace marker slice.
1668    optional int64 dur = 5;
1669
1670    // Details about each of the frames within the CUJ.
1671    repeated Frame frame = 6;
1672
1673    // Details about each of the SF frames within the CUJ.
1674    repeated Frame sf_frame = 10;
1675
1676    // Metrics extracted from the counters output by FrameTracker
1677    // Does not contain the frame_dur percentile information.
1678    optional Metrics counter_metrics = 7;
1679
1680    // Metrics extracted from the frame timeline.
1681    optional Metrics timeline_metrics = 8;
1682
1683    // Metrics extracted from the trace slices.
1684    optional Metrics trace_metrics = 9;
1685
1686    // Layer name of the surface where the cuj is drawn.
1687    optional string layer_name = 11;
1688  }
1689
1690  // Next id: 10
1691  message Frame {
1692    // Index of the frame within the single user journey.
1693    optional int64 frame_number = 1;
1694
1695    // VSYNC ID of the frame.
1696    optional int64 vsync = 2;
1697
1698    optional int64 ts = 3;
1699    optional int64 dur = 4;
1700    optional int64 dur_expected = 7;
1701
1702    // Whether the app process missed the frame deadline.
1703    // Only set for the App frames. Always left unset for SF frames.
1704    optional bool app_missed = 5;
1705
1706    // Whether SF missed the frame deadline.
1707    optional bool sf_missed = 6;
1708
1709    // Whether the SF callback missed before emitting jank metrics.
1710    // SF callback is used to get the jank classification.
1711    optional bool sf_callback_missed = 8;
1712
1713    // Whether the HWUI callback missed before emitting jank metrics.
1714    // HWUI callback is used to get the frame duration.
1715    optional bool hwui_callback_missed = 9;
1716  }
1717
1718  // Next id: 18
1719  message Metrics {
1720    // Overall number of frames within the CUJ.
1721    optional int64 total_frames = 1;
1722
1723    // Number of missed frames.
1724    optional int64 missed_frames = 2;
1725
1726    // Number of frames missed due to the app missing the deadline.
1727    optional int64 missed_app_frames = 3;
1728
1729    // Number of frames missed due to SF.
1730    optional int64 missed_sf_frames = 4;
1731
1732    // Number of successive frames missed.
1733    // Not available in timeline_metrics and trace_metrics.
1734    optional int64 missed_frames_max_successive = 5;
1735
1736    // Max frame duration in nanoseconds.
1737    optional int64 frame_dur_max = 6;
1738
1739    // Average frame duration in nanoseconds.
1740    // Not available in counter_metrics.
1741    optional int64 frame_dur_avg = 7;
1742
1743    // Median frame duration in nanoseconds.
1744    // Not available in counter_metrics.
1745    optional int64 frame_dur_p50 = 8;
1746
1747    // P90 frame duration in nanoseconds.
1748    // Not available in counter_metrics.
1749    optional int64 frame_dur_p90 = 9;
1750
1751    // P95 frame duration in nanoseconds.
1752    // Not available in counter_metrics.
1753    optional int64 frame_dur_p95 = 10;
1754
1755    // P99 frame duration in nanoseconds.
1756    // Not available in counter_metrics.
1757    optional int64 frame_dur_p99 = 11;
1758
1759    // Median frame duration in milliseconds.
1760    // Not available in counter_metrics.
1761    optional double frame_dur_ms_p50 = 12;
1762
1763    // P90 frame duration in milliseconds.
1764    // Not available in counter_metrics.
1765    optional double frame_dur_ms_p90 = 13;
1766
1767    // P95 frame duration in milliseconds.
1768    // Not available in counter_metrics.
1769    optional double frame_dur_ms_p95 = 14;
1770
1771    // P99 frame duration in milliseconds.
1772    // Not available in counter_metrics.
1773    optional double frame_dur_ms_p99 = 15;
1774
1775    // Number of frames with missed SF callback.
1776    optional int64 sf_callback_missed_frames = 16;
1777
1778    // Number of frames with missed HWUI callback.
1779    optional int64 hwui_callback_missed_frames = 17;
1780  }
1781}
1782
1783// End of protos/perfetto/metrics/android/jank_cuj_metric.proto
1784
1785// Begin of protos/perfetto/metrics/android/java_heap_class_stats.proto
1786
1787message JavaHeapClassStats {
1788  // Next id: 13
1789  message TypeCount {
1790    reserved 11;
1791    optional string type_name = 1;
1792    optional bool is_libcore_or_array = 12;
1793
1794    optional int64 obj_count = 2;
1795    optional int64 size_bytes = 3;
1796    optional int64 native_size_bytes = 4;
1797    optional int64 reachable_obj_count = 5;
1798    optional int64 reachable_size_bytes = 6;
1799    optional int64 reachable_native_size_bytes = 7;
1800    optional int64 dominated_obj_count = 8;
1801    optional int64 dominated_size_bytes = 9;
1802    optional int64 dominated_native_size_bytes = 10;
1803  }
1804
1805  message Sample {
1806    optional int64 ts = 1;
1807    repeated TypeCount type_count = 2;
1808  }
1809
1810  // Stats per process. One sample per dump (with continuous dump you can
1811  // have more samples differentiated by ts).
1812  message InstanceStats {
1813    optional uint32 upid = 1;
1814    optional perfetto.protos.AndroidProcessMetadata process = 2;
1815    repeated Sample samples = 3;
1816  }
1817
1818  repeated InstanceStats instance_stats = 1;
1819}
1820
1821// End of protos/perfetto/metrics/android/java_heap_class_stats.proto
1822
1823// Begin of protos/perfetto/metrics/android/java_heap_histogram.proto
1824
1825message JavaHeapHistogram {
1826  // Next id: 9
1827  message TypeCount {
1828    optional string type_name = 1;
1829    optional string category = 4;
1830
1831    optional uint32 obj_count = 2;
1832    optional uint32 reachable_obj_count = 3;
1833
1834    optional uint32 size_kb = 5;
1835    optional uint32 reachable_size_kb = 6;
1836    optional uint32 native_size_kb = 7;
1837    optional uint32 reachable_native_size_kb = 8;
1838  }
1839
1840  message Sample {
1841    optional int64 ts = 1;
1842    repeated TypeCount type_count = 2;
1843  }
1844
1845  // Heap stats per process. One sample per dump (with continuous dump you can
1846  // have more samples differentiated by ts).
1847  message InstanceStats {
1848    optional uint32 upid = 1;
1849    optional AndroidProcessMetadata process = 2;
1850    repeated Sample samples = 3;
1851  }
1852
1853  repeated InstanceStats instance_stats = 1;
1854}
1855
1856// End of protos/perfetto/metrics/android/java_heap_histogram.proto
1857
1858// Begin of protos/perfetto/metrics/android/java_heap_stats.proto
1859
1860message JavaHeapStats {
1861  message HeapRoots {
1862    optional string root_type = 1;
1863    optional string type_name = 2;
1864    optional int64 obj_count = 3;
1865  }
1866
1867  // Next id: 12
1868  message Sample {
1869    optional int64 ts = 1;
1870    // Size of the Java heap in bytes
1871    optional int64 heap_size = 2;
1872    // Native size of all the objects (not included in heap_size)
1873    optional int64 heap_native_size = 8;
1874    optional int64 obj_count = 4;
1875    // Size of the reachable objects in bytes.
1876    optional int64 reachable_heap_size = 3;
1877    // Native size of all the reachable objects (not included in
1878    // reachable_heap_size)
1879    optional int64 reachable_heap_native_size = 9;
1880    optional int64 reachable_obj_count = 5;
1881    // Sum of anonymous RSS + swap pages in bytes.
1882    optional int64 anon_rss_and_swap_size = 6;
1883
1884    // ART root objects
1885    repeated HeapRoots roots = 7;
1886    // OOM adjustment score
1887    optional int64 oom_score_adj = 10;
1888    // Process uptime in millis at the time of the heap dump
1889    optional int64 process_uptime_ms = 11;
1890  }
1891
1892  // Heap stats per process. One sample per dump (can be > 1 if continuous
1893  // dump is enabled).
1894  message InstanceStats {
1895    optional uint32 upid = 1;
1896    optional AndroidProcessMetadata process = 2;
1897    repeated Sample samples = 3;
1898  }
1899
1900  repeated InstanceStats instance_stats = 1;
1901}
1902
1903// End of protos/perfetto/metrics/android/java_heap_stats.proto
1904
1905// Begin of protos/perfetto/metrics/android/lmk_metric.proto
1906
1907// LMK stats on Android.
1908message AndroidLmkMetric {
1909  message ByOomScore {
1910    optional int32 oom_score_adj = 1;
1911    optional int32 count = 2;
1912  }
1913
1914  // Total count of LMK events observed in the trace.
1915  optional int32 total_count = 1;
1916  repeated ByOomScore by_oom_score = 2;
1917
1918  // OOM reaper kills. Enabled via the oom/mark_victim point. Should never
1919  // happen.
1920  optional int32 oom_victim_count = 3;
1921}
1922
1923// End of protos/perfetto/metrics/android/lmk_metric.proto
1924
1925// Begin of protos/perfetto/metrics/android/lmk_reason_metric.proto
1926
1927// Global process state at LMK time, used to identify potential culprits.
1928// TODO: rename to AndroidLmkProcessState
1929message AndroidLmkReasonMetric {
1930  message Process {
1931    optional AndroidProcessMetadata process = 1;
1932
1933    // OOM score adj of the process.
1934    optional int32 oom_score_adj = 2;
1935
1936    // RSS + swap.
1937    optional int64 size = 3;
1938
1939    optional int64 file_rss_bytes = 4;
1940    optional int64 anon_rss_bytes = 5;
1941    optional int64 shmem_rss_bytes = 6;
1942    optional int64 swap_bytes = 7;
1943  }
1944  message Lmk {
1945    // OOM score adj of the LMK'ed process.
1946    optional int32 oom_score_adj = 1;
1947
1948    // Total size of the ION heap in bytes during this LMK.
1949    optional int64 ion_heaps_bytes = 4;
1950    // Deprecated. Prefer ion_heaps_bytes.
1951    optional int64 system_ion_heap_size = 2;
1952
1953    // Processes present during this LMK.
1954    repeated Process processes = 3;
1955  }
1956
1957  // LMKs present in the trace, ordered on their timestamp.
1958  repeated Lmk lmks = 1;
1959}
1960
1961// End of protos/perfetto/metrics/android/lmk_reason_metric.proto
1962
1963// Begin of protos/perfetto/metrics/android/mem_metric.proto
1964
1965// Memory metrics on Android.
1966message AndroidMemoryMetric {
1967  message ProcessMetrics {
1968    optional string process_name = 1;
1969    optional ProcessMemoryCounters total_counters = 2;
1970    repeated PriorityBreakdown priority_breakdown = 3;
1971  }
1972
1973  message PriorityBreakdown {
1974    optional string priority = 1;
1975    optional ProcessMemoryCounters counters = 2;
1976  }
1977
1978  message ProcessMemoryCounters {
1979    optional Counter anon_rss = 1;
1980    optional Counter file_rss = 2;
1981    optional Counter swap = 3;
1982    optional Counter anon_and_swap = 4;
1983
1984    // Available when ART trace events are available.
1985    optional Counter java_heap = 5;
1986  }
1987
1988  message Counter {
1989    optional double min = 1;
1990    optional double max = 2;
1991    optional double avg = 3;
1992
1993    // Memory growth observed in the counter sequence. In case of multiple
1994    // processes with the same name, break ties using max.
1995    optional double delta = 4;
1996  }
1997
1998  // Process metrics, grouped by process name
1999  repeated ProcessMetrics process_metrics = 1;
2000}
2001
2002// End of protos/perfetto/metrics/android/mem_metric.proto
2003
2004// Begin of protos/perfetto/metrics/android/mem_unagg_metric.proto
2005
2006// Unaggregated memory metrics on Android.
2007message AndroidMemoryUnaggregatedMetric {
2008  message ProcessValues {
2009    optional string process_name = 1;
2010    optional ProcessMemoryValues mem_values = 2;
2011  }
2012
2013  message ProcessMemoryValues {
2014    repeated Value anon_rss = 1;
2015    repeated Value file_rss = 2;
2016    repeated Value swap = 3;
2017    repeated Value anon_and_swap = 4;
2018  }
2019
2020  message Value {
2021    optional int64 ts = 1;
2022    optional int32 oom_score = 2;
2023    optional double value = 3;
2024  }
2025
2026  // Process metrics for every process instance in trace.
2027  repeated ProcessValues process_values = 1;
2028}
2029
2030// End of protos/perfetto/metrics/android/mem_unagg_metric.proto
2031
2032// Begin of protos/perfetto/metrics/android/monitor_contention_agg_metric.proto
2033
2034 // This metric provides aggregated information about monitor contention graph
2035 // in a trace
2036message AndroidMonitorContentionAggMetric {
2037  // Next id: 2
2038  // Stats for Monitor contention aggregated by process.
2039  message ProcessAggregation {
2040    optional string name = 1;
2041    optional int64 total_contention_count = 2;
2042    optional int64 total_contention_dur = 3;
2043    optional int64 main_thread_contention_count = 4;
2044    optional int64 main_thread_contention_dur = 5;
2045  }
2046  repeated ProcessAggregation process_aggregation = 1;
2047}
2048
2049// End of protos/perfetto/metrics/android/monitor_contention_agg_metric.proto
2050
2051// Begin of protos/perfetto/metrics/android/monitor_contention_metric.proto
2052
2053// This metric provides information about the monitor contention graph in a
2054// trace
2055message AndroidMonitorContentionMetric {
2056  // Next field id: 26
2057  message Node {
2058    // Global context
2059    optional int64 node_parent_id = 1;
2060    optional int64 node_child_id = 24;
2061    optional int64 node_id = 2;
2062    optional int64 ts = 3;
2063    optional int64 dur = 4;
2064    optional int64 monotonic_dur = 25;
2065    optional string process_name = 14;
2066    optional uint32 pid = 23;
2067    optional uint32 waiter_count = 11;
2068    repeated ThreadStateBreakdown thread_states = 19;
2069    repeated BlockedFunctionBreakdown blocked_functions = 20;
2070
2071    // Blocking context
2072    optional string blocking_method = 5;
2073    optional string short_blocking_method = 7;
2074    optional string blocking_src = 9;
2075    optional string blocking_thread_name = 13;
2076    optional bool is_blocking_thread_main = 16;
2077    optional uint32 blocking_thread_tid = 22;
2078
2079    // Blocked context
2080    optional string blocked_method = 6;
2081    optional string short_blocked_method = 8;
2082    optional string blocked_src = 10;
2083    optional string blocked_thread_name = 12;
2084    optional bool is_blocked_thread_main = 15;
2085    optional uint32 blocked_thread_tid = 21;
2086
2087    // Binder context
2088    optional int64 binder_reply_ts = 17;
2089    optional uint32 binder_reply_tid = 18;
2090  }
2091
2092  message ThreadStateBreakdown {
2093    optional string thread_state = 1;
2094    optional int64 thread_state_dur = 2;
2095    optional int64 thread_state_count = 3;
2096  }
2097
2098  message BlockedFunctionBreakdown {
2099    optional string blocked_function = 1;
2100    optional int64 blocked_function_dur = 2;
2101    optional int64 blocked_function_count = 3;
2102  }
2103
2104  repeated Node node = 1;
2105}
2106
2107// End of protos/perfetto/metrics/android/monitor_contention_metric.proto
2108
2109// Begin of protos/perfetto/metrics/android/multiuser_metric.proto
2110
2111// Metrics for Multiuser events, such as switching users.
2112message AndroidMultiuserMetric {
2113
2114  // Holds the data for a Multiuser event.
2115  message EventData {
2116    // Duration of the event (in milliseconds).
2117    optional int32 duration_ms = 1;
2118
2119    // CPU usage of each process during the event.
2120    message CpuUsage {
2121      // The userId of the process (e.g. 0 or 10).
2122      optional int32 user_id = 1;
2123      // The name of the process.
2124      optional string process_name = 2;
2125      // The number of CPU cycles (in megacycles) spent by that process during the event.
2126      optional int32 cpu_mcycles = 3;
2127      // The ratio of this process's cycles to the total for all processes, expressed as a percentage.
2128      optional float cpu_percentage = 4;
2129      // General identifier for this usage source: determined from the process name, user, etc.
2130      // Should be stable across multiple runs (i.e. does not print the user_id directly).
2131      optional string identifier = 5;
2132    }
2133    repeated CpuUsage cpu_usage = 2;
2134  }
2135
2136  // Metrics for a user switch.
2137  optional EventData user_switch = 1;
2138}
2139// End of protos/perfetto/metrics/android/multiuser_metric.proto
2140
2141// Begin of protos/perfetto/metrics/android/network_metric.proto
2142
2143message AndroidNetworkMetric {
2144  message PacketStatistic {
2145    // Packet count.
2146    optional int64 packets = 1;
2147
2148    // Packet Bytes.
2149    optional int64 bytes = 2;
2150
2151    // Timestamp when first packet received or transmitted.
2152    optional int64 first_packet_timestamp_ns = 3;
2153
2154    // Timestamp when last packet received or transmitted.
2155    optional int64 last_packet_timestamp_ns = 4;
2156
2157    // Interval between first & last packet. The minimum interval is 10ms.
2158    optional int64 interval_ns = 5;
2159
2160    // Data Speed.
2161    optional double data_rate_kbps = 6;
2162  }
2163
2164  message CorePacketStatistic {
2165    optional uint32 id = 1;
2166    optional PacketStatistic packet_statistic = 2;
2167  }
2168
2169  message Rx {
2170    // Total packets statistic.
2171    optional PacketStatistic total = 1;
2172
2173    // Per core packets statistic.
2174    repeated CorePacketStatistic core = 2;
2175
2176    // GRO aggregation ratio.
2177    optional string gro_aggregation_ratio = 3;
2178  }
2179
2180  message Tx {
2181    // Total packets statistic.
2182    optional PacketStatistic total = 1;
2183
2184    // Per core packets statistic.
2185    repeated CorePacketStatistic core = 2;
2186  }
2187
2188  message NetDevice {
2189    // Network device name.
2190    optional string name = 1;
2191
2192    // Ingress traffic statistic.
2193    optional Rx rx = 2;
2194
2195    // Egress traffic statistic
2196    optional Tx tx = 3;
2197  }
2198
2199  message NetRxActionStatistic {
2200    // SoftIrq NET_RX action count.
2201    optional int64 count = 1;
2202
2203    // SoftIrq NET_RX action was running in millisecond.
2204    optional double runtime_ms = 2;
2205
2206    // SoftIrq NET_RX action average running time.
2207    optional double avg_runtime_ms = 3;
2208
2209    // CPU megacycles (i.e. cycles divided by 1e6).
2210    optional int64 mcycles = 4;
2211
2212    // Average weighted CPU frequency by the time the NET_RX Action
2213    // running at each frequency.
2214    optional int64 avg_freq_khz = 5;
2215  }
2216
2217  message NetTxActionStatistic {
2218    // SoftIrq NET_TX action count.
2219    optional int64 count = 1;
2220
2221    // SoftIrq NET_TX action was running in millisecond.
2222    optional double runtime_ms = 2;
2223
2224    // SoftIrq NET_TX action average running time.
2225    optional double avg_runtime_ms = 3;
2226
2227    // CPU megacycles (i.e. cycles divided by 1e6).
2228    optional int64 mcycles = 4;
2229
2230    // Average weighted CPU frequency by the time the NET_TX Action
2231    // running at each frequency.
2232    optional int64 avg_freq_khz = 5;
2233  }
2234
2235  message IpiActionStatistic {
2236    // SoftIrq IPI action count.
2237    optional int64 count = 1;
2238
2239    // SoftIrq IPI action was running in millisecond.
2240    optional double runtime_ms = 2;
2241
2242    // SoftIrq IPI action average running time.
2243    optional double avg_runtime_ms = 3;
2244  }
2245
2246  message CoreNetRxActionStatistic {
2247    optional uint32 id = 1;
2248    optional NetRxActionStatistic net_rx_action_statistic = 2;
2249  }
2250
2251  message CoreNetTxActionStatistic {
2252    optional uint32 id = 1;
2253    optional NetTxActionStatistic net_tx_action_statistic = 2;
2254  }
2255
2256  message NetRxAction {
2257    // Total NET_RX action statistics.
2258    optional NetRxActionStatistic total = 1;
2259
2260    // Per core NET_RX action statistics.
2261    repeated CoreNetRxActionStatistic core = 2;
2262
2263    // The average packet time moves through the kernel stack.
2264    optional double avg_interstack_latency_ms = 3;
2265  }
2266
2267  message NetTxAction {
2268    // Total NET_TX action statistics.
2269    optional NetTxActionStatistic total = 1;
2270
2271    // Per core NET_TX action statistics.
2272    repeated CoreNetTxActionStatistic core = 2;
2273  }
2274
2275  message IpiAction {
2276    // Total IPI action statistics.
2277    optional IpiActionStatistic total = 1;
2278  }
2279
2280  // Network device metrics.
2281  repeated NetDevice net_devices = 1;
2282
2283  // SoftIrq NET_RX action metrics.
2284  optional NetRxAction net_rx_action = 2;
2285
2286  // Packet retransmission rate.
2287  optional double retransmission_rate = 3;
2288
2289  // Kfree Skb rate (i.e. kfree_skb count divided by the packet count from all
2290  // net devices).
2291  optional double kfree_skb_rate = 4;
2292
2293  // SoftIrq NET_TX action metrics.
2294  optional NetTxAction net_tx_action = 5;
2295
2296  // SoftIrq IPI action metrics.
2297  optional IpiAction ipi_action = 6;
2298}
2299
2300// End of protos/perfetto/metrics/android/network_metric.proto
2301
2302// Begin of protos/perfetto/metrics/android/package_list.proto
2303
2304message AndroidPackageList {
2305  message Package {
2306    optional string package_name = 1;
2307    optional int64 uid = 2;
2308    optional int64 version_code = 3;
2309  }
2310
2311  repeated Package packages = 1;
2312}
2313
2314// End of protos/perfetto/metrics/android/package_list.proto
2315
2316// Begin of protos/perfetto/metrics/android/powrails_metric.proto
2317
2318message AndroidPowerRails {
2319  // Energy data per Power Rail at given ts.
2320  message EnergyData {
2321    // Time since device boot(CLOCK_BOTTOMTIME) in milli-seconds.
2322    optional int64 timestamp_ms = 1;
2323    // Accumulated energy since device boot in microwatt-seconds(uws).
2324    optional double energy_uws = 2;
2325  }
2326
2327  message PowerRails {
2328    // Name of the rail.
2329    optional string name = 1;
2330    // Energy data for given rail and for all samples in the trace.
2331    repeated EnergyData energy_data = 2;
2332    // The average used power between the first and the last sampled
2333    // energy data in miliwatt (mw)
2334    optional double avg_used_power_mw = 3;
2335  }
2336
2337  // Energy data per Power Rail.
2338  repeated PowerRails power_rails = 1;
2339
2340  // The average used power between the first and last sampled rail across all
2341  // the rails in milliwatts (mw).
2342  optional double avg_total_used_power_mw = 2;
2343}
2344// End of protos/perfetto/metrics/android/powrails_metric.proto
2345
2346// Begin of protos/perfetto/metrics/android/profiler_smaps.proto
2347
2348message ProfilerSmaps {
2349  message Mapping {
2350    optional string path = 1;
2351    optional int32 size_kb = 2;
2352    optional int32 private_dirty_kb = 3;
2353    optional int32 swap_kb = 4;
2354  }
2355
2356  message Instance {
2357    optional AndroidProcessMetadata process = 1;
2358    repeated Mapping mappings = 2;
2359  }
2360
2361  repeated Instance instance = 1;
2362}
2363
2364// End of protos/perfetto/metrics/android/profiler_smaps.proto
2365
2366// Begin of protos/perfetto/metrics/android/rt_runtime_metric.proto
2367
2368// measure max RT runtime and RT tasks running over 5ms.
2369message AndroidRtRuntimeMetric {
2370  message RtSlice {
2371    // thread name
2372    optional string tname = 1;
2373    // timestamp
2374    optional int64 ts = 2;
2375    // runtime of RT task
2376    optional int64 dur = 3;
2377  }
2378
2379  // max runtime of RT tasks
2380  optional int64 max_runtime = 1;
2381  // how many RT tasks are over 5ms.
2382  optional int64 over_5ms_count = 2;
2383  // information for top 10 RT tasks
2384  repeated RtSlice longest_rt_slices = 3;
2385}
2386
2387
2388// End of protos/perfetto/metrics/android/rt_runtime_metric.proto
2389
2390// Begin of protos/perfetto/metrics/android/simpleperf.proto
2391
2392// Metric that stores information related to atrace events generated by
2393// simpleperf tool
2394message AndroidSimpleperfMetric {
2395  optional double urgent_ratio = 1;
2396
2397  message PerfEventMetric {
2398    // Simpleperf event name
2399    optional string name = 1;
2400
2401    message Thread {
2402      // Thread ID
2403      optional int32 tid = 1;
2404      // Thread name
2405      optional string name = 2;
2406      // CPU ID
2407      optional int32 cpu = 3;
2408      // Total counter value
2409      optional double total = 4;
2410    }
2411
2412    message Process {
2413      // Process ID
2414      optional int32 pid = 1;
2415      // Process name
2416      optional string name = 2;
2417      // Metrics for each thread in this process.
2418      repeated Thread threads = 3;
2419      // Total counter value over all threads in this process
2420      optional double total = 4;
2421    }
2422
2423    // Metrics for each process
2424    repeated Process processes = 2;
2425
2426    // Total counter value over all processes and threads
2427    optional double total = 3;
2428  }
2429
2430  repeated PerfEventMetric events = 2;
2431}
2432
2433// End of protos/perfetto/metrics/android/simpleperf.proto
2434
2435// Begin of protos/perfetto/metrics/android/startup_metric.proto
2436
2437// Android app startup metrics.
2438message AndroidStartupMetric {
2439  // A simplified view of the task state durations for a thread
2440  // and a span of time.
2441  message TaskStateBreakdown {
2442    optional int64 running_dur_ns = 1;
2443    optional int64 runnable_dur_ns = 2;
2444    optional int64 uninterruptible_sleep_dur_ns = 3;
2445    optional int64 interruptible_sleep_dur_ns = 4;
2446    optional int64 uninterruptible_io_sleep_dur_ns = 5;
2447    optional int64 uninterruptible_non_io_sleep_dur_ns = 6;
2448  }
2449
2450  message McyclesByCoreType {
2451    optional int64 little = 1;
2452    optional int64 big = 2;
2453    optional int64 bigger = 3;
2454    optional int64 unknown = 4;
2455  }
2456
2457  message Slice {
2458    optional int64 dur_ns = 1;
2459    optional double dur_ms = 2;
2460  }
2461
2462  // Timing information spanning the intent received by the
2463  // activity manager to the first frame drawn.
2464  // Next id: 38
2465  message ToFirstFrame {
2466    // The duration between the intent received and first frame.
2467    optional int64 dur_ns = 1;
2468    optional double dur_ms = 17;
2469
2470    // Breakdown of time to first frame by task state for the main thread of
2471    // the process starting up.
2472    optional TaskStateBreakdown main_thread_by_task_state = 2;
2473
2474    // The mcycles taken by this startup across all CPUs (broken down by core
2475    // type).
2476    optional McyclesByCoreType mcycles_by_core_type = 26;
2477
2478    // In this timespan, how many processes (apart from the main activity) were
2479    // spawned.
2480    optional uint32 other_processes_spawned_count = 3;
2481
2482    // Total time spent in activity manager between the initial intent
2483    // and the end of the activity starter.
2484    optional Slice time_activity_manager = 4;
2485
2486    // The following slices follow the typical steps post-fork.
2487    optional Slice time_activity_thread_main = 5;
2488    optional Slice time_bind_application = 6;
2489    optional Slice time_activity_start = 7;
2490    optional Slice time_activity_resume = 8;
2491    optional Slice time_activity_restart = 21;
2492    optional Slice time_choreographer = 9;
2493    optional Slice time_inflate = 22;
2494    optional Slice time_get_resources = 23;
2495
2496    // If we are starting a new process, record the duration from the
2497    // intent being received to the time we call the zygote.
2498    optional Slice time_before_start_process = 10;
2499
2500    // The actual duration of the process start (based on the zygote slice).
2501    optional Slice time_during_start_process = 11;
2502
2503    // The duration from launch to first running state thread of startup
2504    // process.
2505    optional Slice time_to_running_state = 35;
2506
2507    optional Slice to_post_fork = 18;
2508    optional Slice to_activity_thread_main = 19;
2509    optional Slice to_bind_application = 20;
2510
2511    optional Slice time_post_fork = 16;
2512
2513    // Total time on class initialization during app startup.
2514    optional Slice time_class_initialization = 36;
2515    // The total time spent on opening dex files.
2516    optional Slice time_dex_open = 24;
2517    // Total time spent verifying classes during app startup.
2518    optional Slice time_verify_class = 25;
2519
2520    // Number of methods that were compiled by JIT during app startup.
2521    optional uint32 jit_compiled_methods = 27;
2522
2523    // Number of class initializations during app startup.
2524    optional uint32 class_initialization_count = 37;
2525
2526    // Time spent running CPU on jit thread pool.
2527    optional Slice time_jit_thread_pool_on_cpu = 28;
2528
2529    // Time spent on garbage collection.
2530    optional Slice time_gc_total = 29;
2531    optional Slice time_gc_on_cpu = 30;
2532
2533    // Time spent in lock contention on the main thread of the process being
2534    // started up. This includes *all* types of lock contention not just monitor
2535    // contention.
2536    optional Slice time_lock_contention_thread_main = 31;
2537
2538    // Time spent in monitor lock contention on the main thread of the
2539    // process being started up. This will be a subset of the time counted by
2540    // |time_lock_contention_thread_main|.
2541    optional Slice time_monitor_contention_thread_main = 32;
2542
2543    // Time spent in opening dex files on the main thread of the process
2544    // being started up.
2545    optional Slice time_dex_open_thread_main = 33;
2546
2547    // Time spent in dlopening .so files on the main thread of the process
2548    // being started up.
2549    optional Slice time_dlopen_thread_main = 34;
2550
2551    // Removed: was other_process_to_activity_cpu_ratio.
2552    reserved 12;
2553
2554    // Removed: was uint32 versions of to_post_fork, to_activity_thread_main and
2555    // to_bind_application.
2556    reserved 13, 14, 15;
2557  }
2558
2559  // Metrics about startup which were developed by looking at experiments using
2560  // high-speed cameras (HSC).
2561  message HscMetrics {
2562    // The duration of the full "startup" as defined by HSC tests.
2563    optional Slice full_startup = 1;
2564  }
2565
2566  message Activity {
2567    optional string name = 1;
2568    optional string method = 2;
2569    optional int64 ts_method_start = 4;
2570
2571    // Field 3 contained Slice with a sum of durations for matching slices.
2572    reserved 3;
2573  }
2574
2575  message BinderTransaction {
2576    optional Slice duration = 1;
2577    optional string thread = 2;
2578    optional string destination_thread = 3;
2579    optional string destination_process = 4;
2580    // From
2581    // https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/protos/perfetto/trace/ftrace/binder.proto;l=15;drc=7b6a788162a30802f4c9d8d7a30a54e25edd30f1
2582    optional string flags = 5;
2583    // From
2584    // https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/protos/perfetto/trace/ftrace/binder.proto;l=14;drc=7b6a788162a30802f4c9d8d7a30a54e25edd30f1
2585    optional string code = 6;
2586    // From
2587    // https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/protos/perfetto/trace/ftrace/binder.proto;l=37;drc=7b6a788162a30802f4c9d8d7a30a54e25edd30f1
2588    optional int64 data_size = 7;
2589  }
2590
2591  // Metrics with information about the status of odex files and the outcome
2592  // of the loading process.
2593  // Multiple files might be loaded for a single startup. Platform might also
2594  // decide to discard an odex file and instead load a fallback, for example
2595  // in case the OS or apk were updated.
2596  message OptimizationStatus {
2597    optional string odex_status = 1;
2598    optional string compilation_filter = 2;
2599    optional string compilation_reason = 3;
2600    optional string location = 4;
2601    optional string summary = 5;
2602  }
2603
2604  // Contains the name and duration of class verification occurred during
2605  // the startup.
2606  message VerifyClass {
2607    optional string name = 1;
2608    optional int64 dur_ns = 2;
2609  }
2610
2611  // Contains timestamps of important events which occurred during the
2612  // startup.
2613  message EventTimestamps {
2614    optional int64 intent_received = 1;
2615    optional int64 first_frame = 2;
2616  }
2617
2618  // Contains information about the state of a system during the app startup.
2619  // Useful to put the startup in context.
2620  message SystemState {
2621    // Whether the dex2oat64 process was running concurrent to the startup.
2622    // Deprecated as of 10/2022.
2623    optional bool dex2oat_running = 1 [deprecated = true];
2624
2625    // Whether the installd process was running concurrent to the startup.
2626    // Deprecated as of 10/2022.
2627    optional bool installd_running = 2 [deprecated = true];
2628
2629    // The number of broadcasts dispatched by the system during the app
2630    // launch.
2631    optional int64 broadcast_dispatched_count = 3;
2632
2633    // The number of broadcasts received by an app or the system during the
2634    // app launch. Note that multiple packages can be subscribed to the same
2635    // broadcast so a single dsipatch can cause multiple packages to receive
2636    // and process a broadcast.
2637    optional int64 broadcast_received_count = 4;
2638
2639    // The most active (i.e. consuming the most mcycles) processes during the
2640    // app launch excluding the process(es) being launched.
2641    // Note: the exact number of returned is an implementation detail and
2642    // will likely change over time.
2643    repeated string most_active_non_launch_processes = 5;
2644
2645    // Duration the installd process was running concurrent to the startup.
2646    optional int64 installd_dur_ns = 6;
2647    // Duration the dex2oat64 process was running concurrent to the startup.
2648    optional int64 dex2oat_dur_ns = 7;
2649  }
2650
2651  // Contains detailed information for slow startup causes.
2652  message SlowStartReasonDetailed {
2653    optional string reason = 1;
2654    optional string details = 2;
2655  }
2656
2657  // Contains information for slow startup causes.
2658  // Next id: 11.
2659  message SlowStartReason {
2660    // Points to reason description and solution.
2661    enum ReasonId {
2662      REASON_ID_UNSPECIFIED = 0;
2663      NO_BASELINE_OR_CLOUD_PROFILES = 1;
2664      RUN_FROM_APK = 2;
2665      UNLOCK_RUNNING = 3;
2666      APP_IN_DEBUGGABLE_MODE = 4;
2667      GC_ACTIVITY = 5;
2668      DEX2OAT_RUNNING = 6;
2669      INSTALLD_RUNNING = 7;
2670      MAIN_THREAD_TIME_SPENT_IN_RUNNABLE = 8;
2671      MAIN_THREAD_TIME_SPENT_IN_INTERRUPTIBLE_SLEEP = 9;
2672      MAIN_THREAD_TIME_SPENT_IN_BLOCKING_IO = 10;
2673      MAIN_THREAD_TIME_SPENT_IN_OPEN_DEX_FILES_FROM_OAT = 11;
2674      TIME_SPENT_IN_BIND_APPLICATION = 12;
2675      TIME_SPENT_IN_VIEW_INFLATION = 13;
2676      TIME_SPENT_IN_RESOURCES_MANAGER_GET_RESOURCES = 14;
2677      TIME_SPENT_VERIFYING_CLASSES = 15;
2678      POTENTIAL_CPU_CONTENTION_WITH_ANOTHER_PROCESS = 16;
2679      JIT_ACTIVITY = 17;
2680      MAIN_THREAD_LOCK_CONTENTION = 18;
2681      MAIN_THREAD_MONITOR_CONTENTION = 19;
2682      JIT_COMPILED_METHODS = 20;
2683      BROADCAST_DISPATCHED_COUNT = 21;
2684      BROADCAST_RECEIVED_COUNT = 22;
2685      STARTUP_RUNNING_CONCURRENT = 23;
2686      MAIN_THREAD_BINDER_TRANSCATIONS_BLOCKED = 24;
2687    }
2688    optional ReasonId reason_id = 1;
2689
2690    // Brief description for human readability.
2691    optional string reason = 2;
2692
2693    // Severity level for a reason.
2694    enum SeverityLevel {
2695      SEVERITY_UNSPECIFIED = 0;
2696      ERROR = 1;
2697      WARNING = 2;
2698      INFO = 3;
2699    }
2700    optional SeverityLevel severity = 10;
2701
2702    // Expected value (inherited from threshold definition).
2703    optional ThresholdValue expected_value = 3;
2704
2705    // Actual value, can be used to decide severity level.
2706    optional ActualValue actual_value = 4;
2707
2708    // Launch duration
2709    optional int64 launch_dur = 5;
2710
2711    // Sum of durations of slices and thread states in trace_slices_or_threads.
2712    // Can be used to decide if a couple of top slices or threads caused the
2713    // issue.
2714    optional int64 duration = 6;
2715
2716    // Information of a subset of slice and thread sections to focused on,
2717    // sorted by the duration in descending order.
2718    // By checking out the top slices/threads, developers can identify specific
2719    // slices or threads for further investigation.
2720    optional TraceSliceSectionInfo trace_slice_sections = 7;
2721    optional TraceThreadSectionInfo trace_thread_sections = 8;
2722
2723    // Details specific for a reason.
2724    optional string additional_info = 9;
2725  }
2726
2727  message ThresholdValue {
2728    // Expected value. 1 for true and 0 for false for booleans.
2729    optional int64 value = 1;
2730
2731    // Expected value unit. Enum, e.g. "ns", "%"
2732    enum ThresholdUnit {
2733      THRESHOLD_UNIT_UNSPECIFIED = 0;
2734      NS = 1;
2735      PERCENTAGE = 2;
2736      TRUE_OR_FALSE = 3;
2737      COUNT = 4;
2738    }
2739    optional ThresholdUnit unit = 2;
2740
2741    // For numeric threshold values only. When higher_expected is true,
2742    // an app startup is considered performant if actual value is higher
2743    // than the threshold.
2744    optional bool higher_expected = 3;
2745  }
2746
2747  message ActualValue {
2748    // Actual value. 1 for true and 0 for false for booleans.
2749    optional int64 value = 1;
2750
2751    // Actual duration for percentage thresholds only.
2752    // E.g. if the threashold is 20% and the launch_duration is 1000ms,
2753    // then the actual duration is more than 200ms.
2754    optional int64 dur = 2;
2755  }
2756
2757  // Contains information for a section of a slice.
2758  message TraceSliceSection {
2759    optional int64 start_timestamp = 1;
2760
2761    optional int64 end_timestamp = 2;
2762
2763    optional uint32 slice_id = 3;
2764
2765    optional string slice_name = 4;
2766
2767    optional uint32 process_pid = 5;
2768
2769    optional uint32 thread_tid = 6;
2770  }
2771
2772  // Information for the SliceSections
2773  message TraceSliceSectionInfo {
2774    repeated TraceSliceSection slice_section = 1;
2775    optional int64 start_timestamp = 2;
2776    optional int64 end_timestamp = 3;
2777  }
2778
2779  // Contains information for a section of a thread.
2780  message TraceThreadSection {
2781    optional int64 start_timestamp = 1;
2782
2783    optional int64 end_timestamp = 2;
2784
2785    // Deprecated as of 09/2024
2786    optional uint32 thread_utid = 3;
2787
2788    optional string thread_name = 4;
2789
2790    optional uint32 process_pid = 5;
2791
2792    optional uint32 thread_tid = 6;
2793  }
2794
2795  // Information for the ThreadSections
2796  message TraceThreadSectionInfo {
2797    repeated TraceThreadSection thread_section = 1;
2798    optional int64 start_timestamp  = 2;
2799    optional int64 end_timestamp = 3;
2800  }
2801
2802  // Next id: 26
2803  message Startup {
2804    // Random id uniquely identifying an app startup in this trace.
2805    optional uint32 startup_id = 1;
2806
2807    // Startup type (cold / warm / hot)
2808    optional string startup_type = 16;
2809
2810    // Number of CPUs the device has
2811    optional uint32 cpu_count = 25;
2812
2813    // Name of the package launched
2814    optional string package_name = 2;
2815
2816    // Name of the process launched
2817    optional string process_name = 3;
2818
2819    // Details about the activities launched
2820    repeated Activity activities = 11;
2821
2822    // Details about slow binder transactions during the startup. The definition
2823    // of a slow transaction is an implementation detail.
2824    repeated BinderTransaction long_binder_transactions = 14;
2825
2826    // Did we ask the zygote for a new process
2827    optional bool zygote_new_process = 4;
2828
2829    // Number of processes hosting the activity involved in the launch.
2830    // This will usually be 1. If it is 0, it is indicative of a data / process
2831    // error. If > 1, the process died during startup and the system respawned
2832    // it.
2833    optional uint32 activity_hosting_process_count = 6;
2834
2835    // Time it takes to display the first frame of the app`s UI.
2836    // Details:
2837    // https://developer.android.com/topic/performance/vitals/launch-time#time-initial
2838    optional int64 time_to_initial_display = 22;
2839
2840    // Time to full display (TTFD) is the time ittakes for an app to become
2841    // interactive for the user.
2842    // Datails:
2843    // https://developer.android.com/topic/performance/vitals/launch-time#time-full
2844    optional int64 time_to_full_display = 23;
2845
2846    // Contains timestamps of important events which happened during
2847    // the startup.
2848    optional EventTimestamps event_timestamps = 13;
2849
2850    // Timing information spanning the intent received by the
2851    // activity manager to the first frame drawn.
2852    optional ToFirstFrame to_first_frame = 5;
2853
2854    // Details about the process (uid, version, etc)
2855    optional AndroidProcessMetadata process = 7;
2856
2857    // Metrics about startup which were developed by looking at experiments
2858    // using high-speed cameras (HSC).
2859    optional HscMetrics hsc = 8;
2860
2861    // The time taken in the startup from intent received to the start time
2862    // of the reportFullyDrawn slice. This should be longer than the time to
2863    // first frame as the application decides this after it starts rendering.
2864    optional Slice report_fully_drawn = 9;
2865
2866    // Contains information about the status of odex files.
2867    repeated OptimizationStatus optimization_status = 12;
2868
2869    // Contains information about the class verification.
2870    repeated VerifyClass verify_class = 19;
2871
2872    // Contains the dlopen file names.
2873    repeated string dlopen_file = 20;
2874
2875    // Package name of startups running concurrent to the launch.
2876    repeated string startup_concurrent_to_launch = 18;
2877
2878    // Contains information about the state of the rest of the system during the
2879    // startup. This is useful for getting context about why a startup might
2880    // be slow beyond just what the app is doing.
2881    optional SystemState system_state = 15;
2882
2883    // A list of identified potential causes for slow startup.
2884    // Optional.
2885    repeated string slow_start_reason = 17;
2886
2887    // Same as slow_start_reason, but with more detailed information, obsolete.
2888    repeated SlowStartReasonDetailed slow_start_reason_detailed = 21;
2889
2890    // Similar to slow_start_reason_detailed, but with much more comprehensive
2891    // info. such as expected threshold, actual value and threads/slices to
2892    // inspect. slow_start_reason will be obsolete once
2893    // slow_start_reason_with_details is completed since
2894    // slow_start_reason_with_details contains all the data in slow_start_reason
2895    // and more.
2896    repeated SlowStartReason slow_start_reason_with_details = 24;
2897
2898    reserved 10;
2899  }
2900
2901  repeated Startup startup = 1;
2902}
2903
2904// End of protos/perfetto/metrics/android/startup_metric.proto
2905
2906// Begin of protos/perfetto/metrics/android/surfaceflinger.proto
2907
2908message AndroidSurfaceflingerMetric {
2909  // Counts the number of missed frames in the trace.
2910  optional uint32 missed_frames = 1;
2911
2912  // Counts the number of missed HWC frames in the trace.
2913  optional uint32 missed_hwc_frames = 2;
2914
2915  // Counts the number of missed GPU frames in the trace.
2916  optional uint32 missed_gpu_frames = 3;
2917
2918  // Calculate the number of missed frames divided by
2919  // total frames
2920  optional double missed_frame_rate = 4;
2921
2922  // Calculate the number of missed HWC frames divided by
2923  // total HWC frames
2924  optional double missed_hwc_frame_rate = 5;
2925
2926  // Calculate the number of missed GPU frames divided by
2927  // total GPU frames
2928  optional double missed_gpu_frame_rate = 6;
2929
2930  // Count the number of times SurfaceFlinger needs to invoke GPU
2931  // for rendering some layers
2932  optional uint32 gpu_invocations = 7;
2933
2934  // Calculate the average duration of GPU request by SurfaceFlinger
2935  // since it enters the FenceMonitor's queue until it gets completed
2936  optional double avg_gpu_waiting_dur_ms = 8;
2937
2938  // Calculate the total duration when there is at least one GPU request
2939  // by SurfaceFlinger that is still waiting for GPU to complete the
2940  // request.
2941  // This also equals to the total duration of
2942  // "waiting for GPU completion <fence_num>" in SurfaceFlinger.
2943  optional double total_non_empty_gpu_waiting_dur_ms = 9;
2944
2945  message MetricsPerDisplay {
2946    // Display ID in SF
2947    optional string display_id = 1;
2948
2949    // Counts the number of missed frames in the trace.
2950    optional uint32 missed_frames = 2;
2951
2952    // Counts the number of missed HWC frames in the trace.
2953    optional uint32 missed_hwc_frames = 3;
2954
2955    // Counts the number of missed GPU frames in the trace.
2956    optional uint32 missed_gpu_frames = 4;
2957
2958    // Calculate the number of missed frames divided by
2959    // total frames
2960    optional double missed_frame_rate = 5;
2961
2962    // Calculate the number of missed HWC frames divided by
2963    // total HWC frames
2964    optional double missed_hwc_frame_rate = 6;
2965
2966    // Calculate the number of missed GPU frames divided by
2967    // total GPU frames
2968    optional double missed_gpu_frame_rate = 7;
2969  }
2970
2971  repeated MetricsPerDisplay metrics_per_display = 10;
2972}
2973
2974// End of protos/perfetto/metrics/android/surfaceflinger.proto
2975
2976// Begin of protos/perfetto/metrics/android/sysui_slice_performance_statistical_data.proto
2977
2978// Statistical performance data row for a set of slices
2979message SysUiSlicePerformanceStatisticalData {
2980  // Name of the Slice
2981  optional string name = 1;
2982  // Number of times it happened within the CUJ
2983  optional int64 cnt = 2;
2984  // Average duration within the CUJ
2985  optional int64 avg_dur_ms = 3;
2986  // Maximal duration within the CUJ
2987  optional int64 max_dur_ms = 4;
2988  // Average duration within the CUJ in nanoseconds
2989  optional int64 avg_dur_ns = 6;
2990  // Maximal duration within the CUJ in nanoseconds
2991  optional int64 max_dur_ns = 7;
2992}
2993// End of protos/perfetto/metrics/android/sysui_slice_performance_statistical_data.proto
2994
2995// Begin of protos/perfetto/metrics/android/sysui_notif_shade_list_builder_metric.proto
2996// System UI Notifications ShadeListBuilder.buildList slices.
2997// Shows count, average duration, and max duration for each.
2998message SysuiNotifShadeListBuilderMetric {
2999  optional SysUiSlicePerformanceStatisticalData all_slices_performance = 1;
3000  optional SysUiSlicePerformanceStatisticalData slices_with_inflation_performance = 2;
3001  optional SysUiSlicePerformanceStatisticalData slices_with_modification_performance = 3;
3002
3003  // Data row for a single slice
3004  message SliceDuration {
3005    // Name of the Slice
3006    optional string name = 1;
3007
3008    // Duration in ms
3009    optional int64 dur_ms = 2;
3010
3011    // Duration in ns
3012    optional int64 dur_ns = 3;
3013  }
3014  repeated SliceDuration slice = 4;
3015}
3016// End of protos/perfetto/metrics/android/sysui_notif_shade_list_builder_metric.proto
3017
3018// Begin of protos/perfetto/metrics/android/sysui_update_notif_on_ui_mode_changed_metric.proto
3019
3020// System UI Notifications ShadeListBuilder.buildList slices.
3021// Shows count, average duration, and max duration for each.
3022message SysuiUpdateNotifOnUiModeChangedMetric {
3023  optional SysUiSlicePerformanceStatisticalData all_slices_performance = 1;
3024  // Data row for a single slice
3025  message SliceDuration {
3026    // Name of the Slice
3027    optional string name = 1;
3028
3029    // Duration in ms
3030    optional int64 dur_ms = 2;
3031
3032    // Duration in ns
3033    optional int64 dur_ns = 3;
3034  }
3035  repeated SliceDuration slice = 2;
3036}
3037// End of protos/perfetto/metrics/android/sysui_update_notif_on_ui_mode_changed_metric.proto
3038
3039// Begin of protos/perfetto/metrics/android/task_names.proto
3040
3041message AndroidTaskNames {
3042  message Process {
3043    optional int64 pid = 1;
3044
3045    // Process name.
3046    optional string process_name = 2;
3047
3048    // Names of all threads for this process.
3049    repeated string thread_name = 3;
3050
3051    // User id under which this process runs.
3052    optional int64 uid = 4;
3053
3054    // Packages matching the process uid.
3055    repeated string uid_package_name = 5;
3056
3057    // Removed, was short_lived_tasks.
3058    reserved 6;
3059
3060    // Removed, was long_lived_tasks.
3061    reserved 7;
3062  }
3063
3064  repeated Process process = 1;
3065}
3066
3067// End of protos/perfetto/metrics/android/task_names.proto
3068
3069// Begin of protos/perfetto/metrics/android/trace_quality.proto
3070
3071// Metric which checks the data in the trace processor tables is "reasonble"
3072// (i.e. we would expect to see it from a real device).
3073//
3074// This is useful to reject traces which may be valid (so no stat would be
3075// recorded) but a human would find the trace nonsensical.
3076message AndroidTraceQualityMetric {
3077  message Failure {
3078    // The name of the failed check.
3079    optional string name = 1;
3080  }
3081  repeated Failure failures = 1;
3082}
3083// End of protos/perfetto/metrics/android/trace_quality.proto
3084
3085// Begin of protos/perfetto/metrics/android/unsymbolized_frames.proto
3086
3087message UnsymbolizedFrames {
3088  message Frame {
3089    optional string module = 1;
3090    optional string build_id = 2;
3091    optional int64 address = 3;
3092
3093    // In some cases (Chrome/Webview) the ID that should be used to query
3094    // symbols in Google's internal tera-scale symbolization service is !=
3095    // `build_id` and requires some mangling.
3096    // This field is == 'build_id` for non-chromium cases, and is the breakpad
3097    // module ID (with lowercase hex digics) for chromium cases.
3098    optional string google_lookup_id = 4;
3099  }
3100
3101  repeated Frame frames = 1;
3102}
3103
3104// End of protos/perfetto/metrics/android/unsymbolized_frames.proto
3105
3106// Begin of protos/perfetto/metrics/android/wattson_in_time_period.proto
3107
3108message AndroidWattsonTimePeriodMetric {
3109  // Each version increment means updated structure format or field
3110  optional int32 metric_version = 1;
3111  // Each version increment means power model has been updated and estimates
3112  // might change for the exact same input. Don't compare estimates across
3113  // different power model versions.
3114  optional int32 power_model_version = 2;
3115  repeated AndroidWattsonEstimateInfo period_info = 3;
3116}
3117
3118message AndroidWattsonEstimateInfo {
3119  optional int32 period_id = 1;
3120  optional string period_name = 2;
3121  optional int64 period_dur = 3;
3122  optional AndroidWattsonCpuSubsystemEstimate cpu_subsystem = 4;
3123}
3124
3125message AndroidWattsonCpuSubsystemEstimate {
3126  // estimates and estimates of subrails
3127  optional float estimated_mw = 1;
3128  optional float estimated_mws = 2;
3129  optional AndroidWattsonPolicyEstimate policy0 = 3;
3130  optional AndroidWattsonPolicyEstimate policy1 = 4;
3131  optional AndroidWattsonPolicyEstimate policy2 = 5;
3132  optional AndroidWattsonPolicyEstimate policy3 = 6;
3133  optional AndroidWattsonPolicyEstimate policy4 = 7;
3134  optional AndroidWattsonPolicyEstimate policy5 = 8;
3135  optional AndroidWattsonPolicyEstimate policy6 = 9;
3136  optional AndroidWattsonPolicyEstimate policy7 = 10;
3137  optional AndroidWattsonDsuScuEstimate dsu_scu = 11;
3138}
3139
3140message AndroidWattsonPolicyEstimate {
3141  optional float estimated_mw = 1;
3142  optional float estimated_mws = 2;
3143  optional AndroidWattsonCpuEstimate cpu0 = 3;
3144  optional AndroidWattsonCpuEstimate cpu1 = 4;
3145  optional AndroidWattsonCpuEstimate cpu2 = 5;
3146  optional AndroidWattsonCpuEstimate cpu3 = 6;
3147  optional AndroidWattsonCpuEstimate cpu4 = 7;
3148  optional AndroidWattsonCpuEstimate cpu5 = 8;
3149  optional AndroidWattsonCpuEstimate cpu6 = 9;
3150  optional AndroidWattsonCpuEstimate cpu7 = 10;
3151}
3152
3153message AndroidWattsonCpuEstimate {
3154  optional float estimated_mw = 1;
3155  optional float estimated_mws = 2;
3156}
3157
3158message AndroidWattsonDsuScuEstimate {
3159  optional float estimated_mw = 1;
3160  optional float estimated_mws = 2;
3161}
3162
3163// End of protos/perfetto/metrics/android/wattson_in_time_period.proto
3164
3165// Begin of protos/perfetto/metrics/android/wattson_tasks_attribution.proto
3166
3167message AndroidWattsonTasksAttributionMetric {
3168  // Each version increment means updated structure format or field
3169  optional int32 metric_version = 1;
3170  // Each version increment means power model has been updated and estimates
3171  // might change for the exact same input. Don't compare estimates across
3172  // different power model versions.
3173  optional int32 power_model_version = 2;
3174  // Lists tasks (e.g. threads, process, package) and associated estimates
3175  repeated AndroidWattsonTaskPeriodInfo period_info = 3;
3176}
3177
3178// Groups of power per task for each period
3179message AndroidWattsonTaskPeriodInfo {
3180  optional int32 period_id = 1;
3181  optional string period_name = 2;
3182  repeated AndroidWattsonTaskInfo task_info = 3;
3183}
3184
3185message AndroidWattsonTaskInfo {
3186  // Average estimated power for wall duration in mW
3187  optional float estimated_mw = 1;
3188  // Total energy over wall duration across CPUs in mWs
3189  optional float estimated_mws = 2;
3190  // Energy attributed to a thread for causing CPU idle exit
3191  optional float idle_transitions_mws = 3;
3192  // Sum of estimated_mws and idle_transition_mws, which represents the energy
3193  // during the active time and the energy to transition into active,
3194  // respectively
3195  optional float total_mws = 4;
3196  optional string thread_name = 5;
3197  optional string process_name = 6;
3198  optional string package_name = 7;
3199  optional int32 thread_id = 8;
3200  optional int32 process_id = 9;
3201}
3202
3203// End of protos/perfetto/metrics/android/wattson_tasks_attribution.proto
3204
3205// Begin of protos/perfetto/metrics/common/clone_duration.proto
3206
3207message CloneDuration {
3208  message ByBuffer {
3209    optional int32 buffer = 1;
3210    optional int64 duration_ns = 2;
3211  }
3212  repeated ByBuffer by_buffer = 1;
3213}
3214
3215// End of protos/perfetto/metrics/common/clone_duration.proto
3216
3217// Begin of protos/perfetto/metrics/metrics.proto
3218
3219// Trace processor metadata
3220// Next id: 20
3221message TraceMetadata {
3222  reserved 1;
3223  optional int64 trace_duration_ns = 2;
3224  optional string trace_uuid = 3;
3225  optional string android_build_fingerprint = 4;
3226  optional string android_device_manufacturer = 16;
3227  optional int64 android_profile_boot_classpath = 18;
3228  optional int64 android_profile_system_server = 19;
3229  optional int64 statsd_triggering_subscription_id = 5;
3230  optional int64 trace_size_bytes = 6;
3231  repeated string trace_trigger = 7;
3232  optional string trace_causal_trigger = 17;
3233  optional string unique_session_name = 8;
3234  optional string trace_config_pbtxt = 9;
3235  optional int64 sched_duration_ns = 10;
3236  optional int64 tracing_started_ns = 11;
3237  optional int64 android_sdk_version = 12;
3238  optional int64 suspend_count = 13;
3239  optional int64 data_loss_count = 14;
3240  optional int64 error_count = 15;
3241}
3242
3243// Stats counters for the trace.
3244// Defined in src/trace_processor/storage/stats.h
3245message TraceAnalysisStats {
3246  enum Severity {
3247    SEVERITY_UNKNOWN = 0;
3248    SEVERITY_INFO = 1;
3249    SEVERITY_DATA_LOSS = 2;
3250    SEVERITY_ERROR = 3;
3251  }
3252
3253  enum Source {
3254    SOURCE_UNKNOWN = 0;
3255    SOURCE_TRACE = 1;
3256    SOURCE_ANALYSIS = 2;
3257  }
3258
3259  message Stat {
3260    optional string name = 1;
3261    optional uint32 idx = 2;
3262    optional Severity severity = 3;
3263    optional Source source = 4;
3264
3265    optional int64 count = 5;
3266  }
3267
3268  repeated Stat stat = 1;
3269}
3270
3271// Root message for all Perfetto-based metrics (v1 metrics only).
3272//
3273// NOTE: the v1 system is "soft" deprecated: no new metrics are allowed but
3274// we still fully support any existing metrics written using this system.
3275//
3276// DO NOT ADD ANY OTHER FIELDS HERE. ADDITION OF NEW v1 METRICS WITH
3277// IS NO LONGER ALLOWED. PLEASE USE METRICS v2 INSTEAD.
3278message TraceMetrics {
3279  // Metrics which were later removed.
3280  reserved 4, 10, 13, 14, 16, 19;
3281
3282  // Battery counters metric on Android.
3283  optional AndroidBatteryMetric android_batt = 5;
3284
3285  // CPU usage per trace, process and thread.
3286  optional AndroidCpuMetric android_cpu = 6;
3287
3288  // Memory metrics on Android (owned by the Android Telemetry team).
3289  optional AndroidMemoryMetric android_mem = 1;
3290
3291  // Memory metrics on Android in unaggregated form. (owned by the Android
3292  // Telemetry team).
3293  // Note: this generates a lot of data so should not be requested unless it
3294  // is clear that this data is necessary.
3295  optional AndroidMemoryUnaggregatedMetric android_mem_unagg = 11;
3296
3297  // Package list.
3298  optional AndroidPackageList android_package_list = 12;
3299
3300  // ion buffer memory metrics.
3301  optional AndroidIonMetric android_ion = 9;
3302
3303  // fastrpc subsystem memory metrics.
3304  optional AndroidFastrpcMetric android_fastrpc = 31;
3305
3306  // Statistics about low memory kills.
3307  optional AndroidLmkMetric android_lmk = 8;
3308
3309  // Power Rails metrics on Android.
3310  optional AndroidPowerRails android_powrails = 7;
3311
3312  // Startup metrics on Android (owned by the Android Telemetry team).
3313  optional AndroidStartupMetric android_startup = 2;
3314
3315  // Trace metadata (applicable to all traces).
3316  optional TraceMetadata trace_metadata = 3;
3317
3318  // Trace stats (applicable to all traces).
3319  optional TraceAnalysisStats trace_stats = 33;
3320
3321  // Returns stack frames missing symbols.
3322  optional UnsymbolizedFrames unsymbolized_frames = 15;
3323
3324  // If the trace contains a heap graph, output allocation statistics.
3325  optional JavaHeapStats java_heap_stats = 17;
3326
3327  // If the trace contains a heap graph, output histogram.
3328  optional JavaHeapHistogram java_heap_histogram = 21;
3329
3330  // If the trace contains a heap graph, output stats per heap class.
3331  optional JavaHeapClassStats java_heap_class_stats = 67;
3332
3333  // Metrics used to find potential culprits of low-memory kills.
3334  optional AndroidLmkReasonMetric android_lmk_reason = 18;
3335
3336  optional AndroidHwuiMetric android_hwui_metric = 20;
3337
3338  optional AndroidDisplayMetrics display_metrics = 22;
3339
3340  optional AndroidTaskNames android_task_names = 23;
3341
3342  // Deprecated was AndroidThreadTimeInStateMetric
3343  reserved 24;
3344
3345  // Metric associated with surfaceflinger.
3346  optional AndroidSurfaceflingerMetric android_surfaceflinger = 25;
3347
3348  // GPU metrics on Android.
3349  optional AndroidGpuMetric android_gpu = 26;
3350
3351  // Deprecated AndroidSysUiCujMetrics.
3352  reserved 27;
3353
3354  // Interaction and frame timings for CUJs (important UI transitions).
3355  optional AndroidJankCujMetric android_jank_cuj = 48;
3356
3357  // Metric associated with hwcomposer.
3358  optional AndroidHwcomposerMetrics android_hwcomposer = 28;
3359
3360  // Deprecated was AndroidJankMetrics;
3361  reserved 29;
3362
3363  // G2D metrics.
3364  optional G2dMetrics g2d = 30;
3365
3366  // Dmabuf heap metrics.
3367  optional AndroidDmaHeapMetric android_dma_heap = 32;
3368
3369  // Metric to verify the quality of the trace.
3370  optional AndroidTraceQualityMetric android_trace_quality = 34;
3371
3372  // Profiler smaps
3373  optional ProfilerSmaps profiler_smaps = 35;
3374
3375  // Multiuser - metrics for switching users.
3376  optional AndroidMultiuserMetric android_multiuser = 36;
3377
3378  // Metrics related to simpleperf tool
3379  optional AndroidSimpleperfMetric android_simpleperf = 37;
3380
3381  // Metrics for the Camera team.
3382  optional AndroidCameraMetric android_camera = 38;
3383
3384  // Metrics for dynamic voltage and frequency scaling.
3385  optional AndroidDvfsMetric android_dvfs = 39;
3386
3387  // Metrics for network performance.
3388  optional AndroidNetworkMetric android_netperf = 40;
3389
3390  // Metrics for the Camera team.
3391  // Note: this generates a lot of data so should not be requested unless it
3392  // is clear that this data is necessary.
3393  optional AndroidCameraUnaggregatedMetric android_camera_unagg = 41;
3394
3395  // Metrics for RT runtime.
3396  optional AndroidRtRuntimeMetric android_rt_runtime = 42;
3397
3398  // Metrics for IRQ runtime.
3399  optional AndroidIrqRuntimeMetric android_irq_runtime = 43;
3400
3401  // Was metrics for the Trusty team.
3402  reserved 44;
3403  reserved 'android_trusty_workqueues';
3404
3405  // Was summary of concurrent trace recording.
3406  reserved 45;
3407  reserved 'android_other_traces';
3408
3409  // Per-process Binder transaction metrics.
3410  optional AndroidBinderMetric android_binder = 46;
3411
3412  // Metrics for app deadline missed.
3413  optional AndroidFrameTimelineMetric android_frame_timeline_metric = 47;
3414
3415  // Blocking calls (e.g. binder calls) for CUJs (important UI transitions).
3416  optional AndroidBlockingCallsCujMetric android_blocking_calls_cuj_metric = 49;
3417
3418  optional AndroidMonitorContentionMetric android_monitor_contention = 50;
3419
3420  optional AndroidSysUINotificationsBlockingCallsMetric
3421      android_sysui_notifications_blocking_calls_metric = 51;
3422
3423  // Metrics to track codec framework.
3424  optional AndroidCodecMetrics codec_metrics = 52;
3425
3426  // Metric to track Android IO.
3427  optional AndroidIo android_io = 53;
3428
3429  // IO metrics on Android in unaggregated form.
3430  // Note: this generates a lot of data so should not be requested unless it
3431  // is clear that this data is necessary.
3432  optional AndroidIoUnaggregated android_io_unagg = 54;
3433
3434  // Metrics for App Not Responding (ANR) errors.
3435  optional AndroidAnrMetric android_anr = 55;
3436
3437  // Aggregated Android Monitor Contention metrics
3438  optional AndroidMonitorContentionAggMetric android_monitor_contention_agg =
3439      56;
3440
3441  optional AndroidBootMetric android_boot = 57;
3442
3443  // Metric for AdServices module.
3444  optional AdServicesMetric ad_services_metric = 58;
3445
3446  optional SysuiNotifShadeListBuilderMetric
3447      sysui_notif_shade_list_builder_metric = 59;
3448
3449  optional SysuiUpdateNotifOnUiModeChangedMetric
3450      sysui_update_notif_on_ui_mode_changed_metric = 60;
3451
3452  // Metrics for Process starts.
3453  optional AndroidAppProcessStartsMetric android_app_process_starts = 61;
3454
3455  // Android boot unaggregated metrics.
3456  optional AndroidBootUnagg android_boot_unagg = 62;
3457
3458  // Android garbage collection metrics
3459  optional AndroidGarbageCollectionUnaggMetric
3460      android_garbage_collection_unagg = 63;
3461
3462  // Multiuser - metrics for switching users.
3463  // Specific for Android Auto
3464  optional AndroidAutoMultiuserMetric android_auto_multiuser = 64;
3465
3466  // All blocking calls (e.g. binder calls) for a trace.
3467  optional AndroidBlockingCallsUnagg android_blocking_calls_unagg = 65;
3468
3469  // Android OOM unaggregated metrics.
3470  optional AndroidOomAdjusterMetric android_oom_adjuster = 66;
3471
3472  // Android Broadcasts aggregated metrics
3473  optional AndroidBroadcastsMetric android_broadcasts = 68;
3474
3475  // Android Wattson rail estimate for each app startup.
3476  optional AndroidWattsonTimePeriodMetric wattson_app_startup_rails = 69;
3477
3478  // Android Wattson rail estimate for duration of entire trace.
3479  optional AndroidWattsonTimePeriodMetric wattson_trace_rails = 70;
3480
3481  // Android Anomaly metric
3482  optional AndroidAnomalyMetric android_anomaly = 71;
3483
3484  // Android Wattson app startup metrics.
3485  optional AndroidWattsonTasksAttributionMetric wattson_trace_threads = 72;
3486
3487  // Android Wattson thread attribution during markers time window.
3488  optional AndroidWattsonTasksAttributionMetric wattson_markers_threads = 73;
3489
3490  // Android Wattson estimate during markers time window.
3491  optional AndroidWattsonTimePeriodMetric wattson_markers_rails = 74;
3492
3493  // Android Wattson estimate during time windows defined by atrace apps.
3494  optional AndroidWattsonTimePeriodMetric wattson_atrace_apps_rails = 75;
3495
3496  // Android GC stats.
3497  optional AndroidGarbageCollectionStats android_garbage_collection_stats = 76;
3498
3499  optional CloneDuration clone_duration = 77;
3500
3501  // Per-frame blocking calls (e.g. binder calls) during CUJs (important UI
3502  // transitions).
3503  optional AndroidCujBlockingCallsPerFrameMetric
3504      android_blocking_calls_cuj_per_frame_metric = 78;
3505
3506  // Android Wattson thread attribution during app startups.
3507  optional AndroidWattsonTasksAttributionMetric wattson_app_startup_threads =
3508      79;
3509
3510  // Android Wattson thread attribution during atrace app windows.
3511  optional AndroidWattsonTasksAttributionMetric wattson_atrace_apps_threads =
3512      80;
3513
3514  // Android
3515  // Demo extensions.
3516  extensions 450 to 499;
3517
3518  // Vendor extensions.
3519  extensions 500 to 1000;
3520
3521  // Chrome metrics.
3522  extensions 1001 to 2000;
3523
3524  // WebView metrics.
3525  extensions 2001 to 2500;
3526
3527  // DO NOT ADD ANY OTHER FIELDS HERE. ADDITION OF NEW v1 METRICS IS NO LONGER
3528  // ALLOWED. PLEASE USE METRICS v2 INSTEAD.
3529}
3530
3531// End of protos/perfetto/metrics/metrics.proto
3532