xref: /aosp_15_r20/external/perfetto/protos/perfetto/metrics/android/binder_metric.proto (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package perfetto.protos;
20
21// This metric provides the following:
22// 1. Per-process Binder statistics for traces with binder_driver enabled.
23//    Specifically, transactions are categorized and counted
24// 2. Unaggregated binder txn durations with per-txn aggregated thread state and
25// blocked function
26//    durations
27message AndroidBinderMetric {
28  message PerProcessBreakdown {
29    optional string process_name = 1;
30    optional uint32 pid = 2;
31    optional string slice_name = 3;
32    optional uint32 count = 4;
33  }
34
35  // Next field id: 31
36  message UnaggregatedTxnBreakdown {
37    // General
38    optional string aidl_name = 1;
39    optional int64 aidl_ts = 22;
40    optional int64 aidl_dur = 23;
41    optional bool is_sync = 21;
42    // Client
43    // Removed: was binder_txn_id
44    reserved 2;
45    optional string client_process = 3;
46    optional string client_thread = 4;
47    optional bool is_main_thread = 5;
48    optional int64 client_ts = 6;
49    optional int64 client_dur = 7;
50    optional int64 client_monotonic_dur = 28;
51    optional int64 client_oom_score = 19;
52    optional int64 client_package_version_code = 24;
53    optional bool is_client_package_debuggable = 25;
54    // Server
55    // Removed: was binder_reply_id
56    reserved 8;
57    optional string server_process = 9;
58    optional string server_thread = 10;
59    optional int64 server_ts = 11;
60    optional int64 server_dur = 12;
61    optional int64 server_monotonic_dur = 29;
62    optional int64 server_oom_score = 20;
63    optional int64 server_package_version_code = 26;
64    optional bool is_server_package_debuggable = 27;
65    // Aggregations
66    repeated ThreadStateBreakdown thread_states = 13;
67    repeated BlockedFunctionBreakdown blocked_functions = 14;
68    repeated LogicalReasonBreakdown logical_reasons = 31;
69
70    optional uint32 client_tid = 15;
71    optional uint32 server_tid = 16;
72
73    optional uint32 client_pid = 17;
74    optional uint32 server_pid = 18;
75  }
76
77  message ThreadStateBreakdown {
78    optional string thread_state_type = 1;
79    optional string thread_state = 2;
80    optional int64 thread_state_dur = 3;
81    optional int64 thread_state_count = 4;
82  }
83
84  message BlockedFunctionBreakdown {
85    optional string thread_state_type = 1;
86    optional string blocked_function = 2;
87    optional int64 blocked_function_dur = 3;
88    optional int64 blocked_function_count = 4;
89  }
90
91  message LogicalReasonBreakdown {
92    optional string thread_state_type = 1;
93    optional string reason = 2;
94    optional int64 reason_dur = 3;
95  }
96
97  repeated PerProcessBreakdown process_breakdown = 1;
98  repeated UnaggregatedTxnBreakdown unaggregated_txn_breakdown = 2;
99}
100