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