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