1/*
2 * Copyright (C) 2021 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";
18package com.android.internal.os;
19
20option java_outer_classname = "BinderLatencyProto";
21
22/**
23 * RepeatedApiStats proto from atoms.proto, duplicated here so that it's
24 * accessible in the build.
25 * Must be kept in sync with the version in atoms.proto.
26 */
27
28message RepeatedApiStats {
29  repeated ApiStats api_stats = 1;
30}
31
32message Dims {
33  enum ProcessSource {
34    UNKNOWN_PROCESS_SOURCE = 0;
35    SYSTEM_SERVER = 1;
36    TELEPHONY = 2;
37    BLUETOOTH = 3;
38    WIFI = 4;
39  }
40
41  enum ServiceClassName {
42    UNKNOWN_CLASS = 0;
43  }
44  enum ServiceMethodName {
45    UNKNOWN_METHOD = 0;
46  }
47
48  // Required.
49  optional ProcessSource process_source = 1;
50
51  // The class name of the API making the call to Binder. Enum value
52  // is preferred as uses much less data to store.
53  // This field does not contain PII.
54  oneof service_class {
55    ServiceClassName service_class_name_as_enum = 2;
56    string service_class_name = 3;
57  }
58
59  // Method name of the API call. It can also be a transaction code if we
60  // cannot resolve it to a name. See Binder#getTransactionName. Enum value
61  // is preferred as uses much less data to store.
62  // This field does not contain PII.
63  oneof service_method {
64    ServiceMethodName service_method_name_as_enum = 4;
65    string service_method_name = 5;
66  }
67}
68
69message ApiStats {
70  // required.
71  optional Dims dims = 1;
72
73  // Indicates the first bucket that had any data. Allows omitting any empty
74  // buckets at the start of the bucket list and thus save on data size.
75  optional int32 first_bucket_index = 2;
76  // Stores the count of samples for each bucket. The number of buckets and
77  // their sizes are controlled server side with a flag.
78  repeated int32 buckets = 3;
79
80  // Params for histogram buckets.
81  // The number of buckets in the histogram. Store this value separately
82  // as the tail of empty buckets is truncated when stored in the proto to
83  // conserve space. Thus it is not possible to infer this value from there.
84  optional int32 bucket_count = 4;
85
86  // The size (upper bound) of the first bucket (used to avoid creating an
87  // excessive amount of small buckets). E.g. for first_bucket_size of 5, the
88  // first bucket will be [0, 5) and the second will be [5, 5 * scaleFactor).
89  optional int32 first_bucket_size = 5;
90
91  // The rate in which each consecutive bucket increases (before rounding).
92  // Implemented in: com.android.internal.os.BinderLatencyBuckets.
93  optional float scale_factor = 6;
94}
95