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