• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2020 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 com.android.server.powerstats;
20
21option java_multiple_files = true;
22
23/**
24 * IncidentReportMeterProto is used only in the parsing tool located
25 * in frameworks/base/tools which is used to parse this data out of
26 * incident reports.
27 */
28message IncidentReportMeterProto {
29    /** Section number matches that in incident.proto */
30    optional PowerStatsServiceMeterProto incident_report = 3054;
31}
32
33/**
34 * IncidentReportModelProto is used only in the parsing tool located
35 * in frameworks/base/tools which is used to parse this data out of
36 * incident reports.
37 */
38message IncidentReportModelProto {
39    /** Section number matches that in incident.proto */
40    optional PowerStatsServiceModelProto incident_report = 3055;
41}
42
43/**
44 * IncidentReportResidencyProto is used only in the parsing tool located
45 * in frameworks/base/tools which is used to parse this data out of
46 * incident reports.
47 */
48message IncidentReportResidencyProto {
49    /** Section number matches that in incident.proto */
50    optional PowerStatsServiceResidencyProto incident_report = 3056;
51}
52
53/**
54 * EnergyConsumer (model) data is exposed by the PowerStats HAL.  This data
55 * represents modeled energy consumption estimates and is provided per
56 * subsystem.  The default subsystems are defined in EnergyConsumerType.aidl.
57 * Energy model estimates will be logged to incident reports in addition to
58 * the raw energy meter data.
59 */
60message PowerStatsServiceModelProto {
61    repeated EnergyConsumerProto energy_consumer = 1;
62    repeated EnergyConsumerResultProto energy_consumer_result = 2;
63}
64
65/**
66 * EnergyMeasurement (meter) data is exposed by the PowerStats HAL.  This data
67 * represents measurements taken directly from on-device energy meters.
68 * This raw energy meter data will be logged to incident reports.
69 */
70message PowerStatsServiceMeterProto {
71    repeated ChannelProto channel = 1;
72    repeated EnergyMeasurementProto energy_measurement = 2;
73}
74
75/**
76 * A PowerEntity is defined as a platform subsystem, peripheral, or power domain
77 * that impacts the total device power consumption.  PowerEntity is
78 * information related to each power entity.  Each PowerEntity may reside in one
79 * of multiple states. It may also transition from one state to another.
80 * StateResidency is defined as an accumulation of time that a PowerEntity
81 * resided in each of its possible states, the number of times that each state
82 * was entered, and a timestamp corresponding to the last time that state was
83 * entered.
84 */
85message PowerStatsServiceResidencyProto {
86    repeated PowerEntityProto power_entity = 1;
87    repeated StateResidencyResultProto state_residency_result = 2;
88}
89
90/**
91 * Information about the possible states for a particular PowerEntity.
92 */
93message StateProto {
94    /**
95     * Unique (for a given PowerEntity) ID of this State
96     */
97    optional int32 id = 1;
98    /**
99     * Unique (for a given PowerEntity) name of the state. Vendor/device specific.
100     * Opaque to framework
101     */
102    optional string name = 2;
103}
104
105/**
106 * A PowerEntity is defined as a platform subsystem, peripheral, or power domain
107 * that impacts the total device power consumption.  PowerEntity is
108 * information about a PowerEntity.  It includes an array of information about
109 * each possible state of the PowerEntity.
110 */
111message PowerEntityProto {
112    /**
113     * Unique ID of this PowerEntity
114     */
115    optional int32 id = 1;
116    /**
117     * Unique name of the PowerEntity. Vendor/device specific. Opaque to framework
118     */
119    optional string name = 2;
120    /**
121     * List of states that the PowerEntity may reside in
122     */
123    repeated StateProto states = 3;
124}
125
126/**
127 * StateResidency is defined as an accumulation of time that a PowerEntity
128 * resided in each of its possible states, the number of times that each state
129 * was entered, and a timestamp corresponding to the last time that state was
130 * entered.  Data is accumulated starting at device boot.
131 */
132message StateResidencyProto {
133    /**
134     * ID of the state associated with this residency
135     */
136    optional int32 id = 1;
137    /**
138     * Total time in milliseconds that the corresponding PowerEntity resided
139     * in this state since boot
140     */
141    optional int64 total_time_in_state_ms = 2;
142    /**
143     * Total number of times that the state was entered since boot
144     */
145    optional int64 total_state_entry_count = 3;
146    /**
147     * Last time this state was entered. Walltime in milliseconds since Unix epoch.
148     */
149    optional int64 last_entry_timestamp_ms = 4;
150}
151
152/**
153 * A StateResidencyResult is an array of StateResidencies for a particular
154 * PowerEntity.  The StateResidencyResult can be matched to its corresponding
155 * PowerEntity through the id field.
156 */
157message StateResidencyResultProto {
158    /**
159     * ID of the PowerEntity associated with this result
160     */
161    optional int32 id = 1;
162    /**
163     * Residency for each state in the PowerEntity's state space
164     */
165    repeated StateResidencyProto state_residency_data = 2;
166}
167
168/**
169 * Energy consumer:
170 * A list of default subsystems for which energy consumption estimates
171 * may be provided (hardware dependent).
172 */
173message EnergyConsumerProto {
174    /** Unique ID of this EnergyConsumer */
175    optional int32 id = 1;
176
177    /**
178     * For a group of EnergyConsumers of the same logical type, sorting by
179     * ordinal should be give their physical order. No other meaning is
180     * carried by it.
181     */
182    optional int32 ordinal = 2;
183
184    /** Type of this EnergyConsumer */
185    optional int32 type = 3;
186
187    /**
188     * Unique name of this EnergyConsumer. Vendor/device specific. Opaque
189     * to framework
190     */
191    optional string name = 4;
192}
193
194message EnergyConsumerAttributionProto {
195    /** Android ID / Linux UID, the accumulated energy should be attributed to. */
196    optional int32 uid = 1;
197
198    /** Accumulated energy since boot in microwatt-seconds (uWs) for this AID. */
199    optional int64 energy_uws = 2;
200}
201
202/**
203 * Energy consumer result:
204 * An estimate of energy consumption since boot for the subsystem identified
205 * by the unique id.
206 */
207message EnergyConsumerResultProto {
208    /** Unique index identifying the energy consumer. */
209    optional int32 id = 1;
210
211    /** Walltime in milliseconds since Unix epoch */
212    optional int64 timestamp_ms = 2;
213
214    /** Accumulated energy since device boot in microwatt-seconds (uWs) */
215    optional int64 energy_uws = 3;
216
217    /** Optional attribution per UID for this EnergyConsumer. */
218    repeated EnergyConsumerAttributionProto attribution = 4;
219}
220
221/**
222 * Channel information:
223 * Reports information related to the energy meter channels being monitored.
224 */
225message ChannelProto {
226    /**
227     * Index corresponding to the energy meter channel. This index matches
228     * the index returned in Channel.
229     */
230    optional int32 id = 1;
231
232    /** Name of the energy meter channel */
233    optional string name = 2;
234
235    /** Name of the subsystem associated with this Channel. Opaque to framework */
236    optional string subsystem = 3;
237}
238
239/**
240 * Energy measurements:
241 * Reports accumulated energy since boot for each energy meter.
242 */
243message EnergyMeasurementProto {
244    /**
245     * Index corresponding to the energy meter channel. This index matches
246     * the index returned in Channel.
247     */
248    optional int32 id = 1;
249
250    /** Walltime in milliseconds since Unix epoch */
251    optional int64 timestamp_ms = 2;
252
253    /** Accumulated energy since device boot in microwatt-seconds (uWs) */
254    optional int64 energy_uws = 3;
255
256    /** Duration in milliseconds that energy has been accumulated */
257    optional int64 duration_ms = 4;
258
259}
260