blob: 75c6a72fc9284b52563ce418c9afed038d3330a4 [file] [log] [blame]
Vinay Kaliaf12c1712018-10-02 12:59:08 -07001/*
2 * Copyright (C) 2018 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 */
16package android.hardware.power.stats@1.0;
17
18interface IPowerStats {
19
20 /**
21 * Rail information:
22 * Reports information related to the rails being monitored.
23 *
24 * @return rails Information about monitored rails.
25 * @return status SUCCESS on success or NOT_SUPPORTED if
26 * feature is not enabled or FILESYSTEM_ERROR on filesystem nodes
27 * access error.
28 */
29 getRailInfo()
30 generates(vec<RailInfo> rails, Status status);
31
32 /**
33 * Rail level energy measurements for low frequency clients:
34 * Reports accumulated energy since boot on each rail.
35 *
36 * @param railIndices Indices of rails for which data is required.
37 * To get data for all rails pass an empty vector. Rail name to
38 * index mapping can be queried from getRailInfo() API.
39 * @return data Energy values since boot for all requested rails.
40 * @return status SUCCESS on success or NOT_SUPPORTED if
41 * feature is not enabled or FILESYSTEM_ERROR on filesystem nodes
42 * access error.
43 */
44 getEnergyData(vec<uint32_t> railIndices)
45 generates(vec<EnergyData> data, Status status);
46
47 /**
48 * Stream rail level power measurements for high frequency clients:
49 * Streams accumulated energy since boot on each rail. This API is
50 * asynchronous.
51 *
52 * @param timeMs Time(in ms) for which energyData should be streamed
Vinay Kalia3b91fd42018-10-22 19:21:48 -070053 * @param samplingRate Frequency(in Hz) at which samples should be
54 * captured. If the requested sampling rate is not supported then
55 * SUCCESS is returned and numSamples are reported back according
56 * to the supported sampling rate.
57 * @return mqDesc Blocking Synchronous Fast Message Queue descriptor - One
58 * writer(power.stats HAL) and one reader are supported. Data is
59 * present in the following format in the queue:
Vinay Kaliaf12c1712018-10-02 12:59:08 -070060 * +-----------------------+ <--
61 * | EnergyData for rail 1 | |
62 * +-----------------------+ |
63 * | EnergyData for rail 2 | |
64 * +-----------------------+ |
65 * | . | |-- 1st Sample
66 * | . | |
67 * | . | |
68 * +-----------------------+ |
69 * | EnergyData for rail n | |
70 * +-----------------------+ <--
71 * | . |
72 * | . |
73 * | . |
74 * +-----------------------+ <--
75 * | EnergyData for rail 1 | |
76 * +-----------------------+ |
77 * | EnergyData for rail 2 | |
78 * +-----------------------+ |
79 * | . | |-- kth Sample
80 * | . | |
81 * | . | |
82 * +-----------------------+ |
83 * | EnergyData for rail n | |
84 * +-----------------------+ <--
85 *
86 * where,
87 * n = railsPerSample
88 * k = numSamples
89 *
90 * @return numSamples Number of samples which will be generated in timeMs.
91 * @return railsPerSample Number of rails measured per sample.
92 * @return status SUCCESS on success or FILESYSTEM_ERROR on filesystem
Vinay Kalia3b91fd42018-10-22 19:21:48 -070093 * nodes access or NOT_SUPPORTED if feature is not enabled or
94 * INSUFFICIENT_RESOURCES if there are not enough resources.
Vinay Kaliaf12c1712018-10-02 12:59:08 -070095 */
Vinay Kalia3b91fd42018-10-22 19:21:48 -070096 streamEnergyData(uint32_t timeMs, uint32_t samplingRate)
97 generates(fmq_sync<EnergyData> mqDesc, uint32_t numSamples,
Vinay Kaliaf12c1712018-10-02 12:59:08 -070098 uint32_t railsPerSample, Status status);
Benjamin Schwartz6b8d7782018-10-24 10:22:42 -070099
100 /**
101 * PowerEntity information:
102 * Reports information related to all supported PowerEntity(s) for which
103 * data is available. A PowerEntity is defined as a platform subsystem,
104 * peripheral, or power domain that impacts the total device power
105 * consumption.
106 *
107 * @return powerEntityInfos List of information on each PowerEntity
108 * @return status SUCCESS on success or NOT_SUPPORTED if
109 * feature is not enabled or FILESYSTEM_ERROR on filesystem nodes
110 * access error.
111 */
112 getPowerEntityInfo()
113 generates(vec<PowerEntityInfo> powerEntityInfos, Status status);
114
115 /**
116 * PowerEntity state information:
117 * Reports the set of power states for which the specified
118 * PowerEntity(s) provide residency data.
119 *
120 * @param powerEntityIds collection of IDs of PowerEntity(s) for which
121 * state information is requested. PowerEntity name to ID mapping may
122 * be queried from getPowerEntityInfo(). To get state space
123 * information for all PowerEntity(s) pass an empty vector.
124 *
125 * @return powerEntityStateSpaces PowerEntity state space information for
126 * each specified PowerEntity.
127 * @return status SUCCESS if powerEntityStateInfos contains state space
128 * information for at least one PowerEntity, NOT_SUPPORTED if feature
129 * is not enabled, INVALID_INPUT if no requested PowerEntity(s)
130 * provide state space information, FILESYSTEM_ERROR if no state space
131 * information is returned due to filesystem errors.
132 */
133 getPowerEntityStateInfo(vec<uint32_t> powerEntityIds)
134 generates(vec<PowerEntityStateSpace> powerEntityStateSpaces,
135 Status status);
136
137 /**
138 * PowerEntity residencies for low frequency clients:
139 * Reports accumulated residency data for each specified PowerEntity.
140 * Each PowerEntity may reside in one of multiple states. It may also
141 * transition to another state. Residency data is an accumulation of time
142 * that a specified PowerEntity resided in each of its possible states,
143 * the number of times that each state was entered, and a timestamp
144 * corresponding to the last time that state was entered. Data is
145 * accumulated starting from the last time the PowerEntity was reset.
146 *
147 * @param powerEntityId collection of IDs of PowerEntity(s) for which
148 * residency data is requested. PowerEntity name to ID mapping may
149 * be queried from getPowerEntityInfo(). To get state residency
150 * data for all PowerEntity(s) pass an empty vector.
151 * @return stateResidencyResults state residency data for the
152 * specified powerEntity(s)
153 * @return status SUCCESS if stateResidencyResults contains residency
154 * data for at least one PowerEntity, NOT_SUPPORTED if
155 * feature is not enabled, INVALID_INPUT if no requested
156 * PowerEntity(s) provide state residency data, FILESYSTEM_ERROR
157 * if no data is returned due to filesystem errors.
158 */
159 getPowerEntityStateResidencyData(vec<uint32_t> powerEntityIds)
160 generates(vec<PowerEntityStateResidencyResult> stateResidencyResults,
161 Status status);
Vinay Kaliaf12c1712018-10-02 12:59:08 -0700162};