blob: 74ceb8f73c8ab420826d3f7e62d02598bc95a9bf [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
Benjamin Schwartz0a624b92018-11-13 13:48:56 -0800108 * @return status SUCCESS on success, NOT_SUPPORTED if feature is not
109 * enabled, FILESYSTEM_ERROR if there was an error accessing the
110 * filesystem.
Benjamin Schwartz6b8d7782018-10-24 10:22:42 -0700111 */
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
Benjamin Schwartz0a624b92018-11-13 13:48:56 -0800126 * each specified PowerEntity that provides state space information.
127 * @return status SUCCESS on success, NOT_SUPPORTED if feature is not
128 * enabled, FILESYSTEM_ERROR if there was an error accessing the
129 * filesystem, INVALID_INPUT if any requested PowerEntity(s) do not
130 * provide state space information and there was not a filesystem error.
Benjamin Schwartz6b8d7782018-10-24 10:22:42 -0700131 */
132 getPowerEntityStateInfo(vec<uint32_t> powerEntityIds)
133 generates(vec<PowerEntityStateSpace> powerEntityStateSpaces,
134 Status status);
135
136 /**
137 * PowerEntity residencies for low frequency clients:
138 * Reports accumulated residency data for each specified PowerEntity.
139 * Each PowerEntity may reside in one of multiple states. It may also
140 * transition to another state. Residency data is an accumulation of time
141 * that a specified PowerEntity resided in each of its possible states,
142 * the number of times that each state was entered, and a timestamp
143 * corresponding to the last time that state was entered. Data is
144 * accumulated starting from the last time the PowerEntity was reset.
145 *
146 * @param powerEntityId collection of IDs of PowerEntity(s) for which
147 * residency data is requested. PowerEntity name to ID mapping may
148 * be queried from getPowerEntityInfo(). To get state residency
149 * data for all PowerEntity(s) pass an empty vector.
Benjamin Schwartz0a624b92018-11-13 13:48:56 -0800150 * @return stateResidencyResults state residency data for each specified
151 * PowerEntity that provides state residency data.
152 * @return status SUCCESS on success, NOT_SUPPORTED if feature is not
153 * enabled, FILESYSTEM_ERROR if there was an error accessing the
154 * filesystem, INVALID_INPUT if any requested PowerEntity(s) do not
155 * provide state residency data and there was not a filesystem error.
Benjamin Schwartz6b8d7782018-10-24 10:22:42 -0700156 */
157 getPowerEntityStateResidencyData(vec<uint32_t> powerEntityIds)
158 generates(vec<PowerEntityStateResidencyResult> stateResidencyResults,
159 Status status);
Vinay Kaliaf12c1712018-10-02 12:59:08 -0700160};