blob: b5b3cc9a8265a18843a0d10e6ecba2e6da8656b7 [file] [log] [blame]
Vinay Kaliaf91dcb52018-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 Kalia84a48b82018-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 Kaliaf91dcb52018-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 Kalia84a48b82018-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 Kaliaf91dcb52018-10-02 12:59:08 -070095 */
Vinay Kalia84a48b82018-10-22 19:21:48 -070096 streamEnergyData(uint32_t timeMs, uint32_t samplingRate)
97 generates(fmq_sync<EnergyData> mqDesc, uint32_t numSamples,
Vinay Kaliaf91dcb52018-10-02 12:59:08 -070098 uint32_t railsPerSample, Status status);
99};