1/*
2 * Copyright (C) 2017 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 android.drm_metrics;
20
21
22// This message contains the specific metrics captured by DrmMetrics. It is
23// used for serializing and logging metrics.
24// next id: 11.
25message DrmFrameworkMetrics {
26  // TODO: Consider using extensions.
27
28  // Attributes are associated with a recorded value. E.g. A counter may
29  // represent a count of an operation returning a specific error code. The
30  // error code will be an attribute.
31  message Attributes {
32    // Reserved for compatibility with logging proto.
33    reserved 2 to 13;
34
35    // A general purpose error code where 0 means OK.
36    optional int32 error_code = 1;
37
38    // Defined at ::android::hardware::drm::V1_0::KeyStatusType;
39    optional uint32 key_status_type = 14;
40
41    // Defined at ::android::hardware::drm::V1_0::EventType;
42    optional uint32 event_type = 15;
43  }
44
45  // The Counter message is used to store a count value with an associated
46  // Attribute.
47  message Counter {
48    optional uint64 count = 1;
49    // Represents the attributes associated with this counter instance.
50    optional Attributes attributes = 2;
51  }
52
53  // The DistributionMetric is meant to capture the moments of a normally
54  // distributed (or approximately normal) value.
55  message DistributionMetric {
56    optional float min = 1;
57    optional float max = 2;
58    optional float mean = 3;
59    optional double variance = 4;
60    optional uint64 operation_count = 5;
61
62    // Represents the attributes assocated with this distribution metric
63    // instance.
64    optional Attributes attributes = 6;
65  }
66
67  message SessionLifetime {
68    // Start time of the session in milliseconds since epoch.
69    optional uint64 start_time_ms = 1;
70    // End time of the session in milliseconds since epoch.
71    optional uint64 end_time_ms = 2;
72  }
73
74  // The count of open session operations. Each instance has a specific error
75  // code associated with it.
76  repeated Counter open_session_counter = 1;
77
78  // The count of close session operations. Each instance has a specific error
79  // code associated with it.
80  repeated Counter close_session_counter = 2;
81
82  // Count and execution time of getKeyRequest calls.
83  repeated DistributionMetric get_key_request_time_us = 3;
84
85  // Count and execution time of provideKeyResponse calls.
86  repeated DistributionMetric provide_key_response_time_us = 4;
87
88  // Count of getProvisionRequest calls.
89  repeated Counter get_provisioning_request_counter = 5;
90
91  // Count of provideProvisionResponse calls.
92  repeated Counter provide_provisioning_response_counter = 6;
93
94  // Count of key status events broken out by status type.
95  repeated Counter key_status_change_counter = 7;
96
97  // Count of events broken out by event type
98  repeated Counter event_callback_counter = 8;
99
100  // Count getPropertyByteArray calls to retrieve the device unique id.
101  repeated Counter get_device_unique_id_counter = 9;
102
103  // Session ids to lifetime (start and end time) map.
104  // Session ids are strings of hex-encoded byte arrays.
105  map<string, SessionLifetime> session_lifetimes = 10;
106}
107
108