blob: d75e170a1002a1395f1ea0372756aceeb32bda62 [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
53 * @return mqDesc Unsynchronous Fast Message Queue descriptor - One
54 * writer(power.stats HAL) multiple readers are supported. Reader
55 * should read faster than writer otherwise data might be
56 * overwritten. Data is present in following format in the queue:
57 * +-----------------------+ <--
58 * | EnergyData for rail 1 | |
59 * +-----------------------+ |
60 * | EnergyData for rail 2 | |
61 * +-----------------------+ |
62 * | . | |-- 1st Sample
63 * | . | |
64 * | . | |
65 * +-----------------------+ |
66 * | EnergyData for rail n | |
67 * +-----------------------+ <--
68 * | . |
69 * | . |
70 * | . |
71 * +-----------------------+ <--
72 * | EnergyData for rail 1 | |
73 * +-----------------------+ |
74 * | EnergyData for rail 2 | |
75 * +-----------------------+ |
76 * | . | |-- kth Sample
77 * | . | |
78 * | . | |
79 * +-----------------------+ |
80 * | EnergyData for rail n | |
81 * +-----------------------+ <--
82 *
83 * where,
84 * n = railsPerSample
85 * k = numSamples
86 *
87 * @return numSamples Number of samples which will be generated in timeMs.
88 * @return railsPerSample Number of rails measured per sample.
89 * @return status SUCCESS on success or FILESYSTEM_ERROR on filesystem
90 * nodes access or NOT_SUPPORTED if feature is not enabled.
91 */
92 streamEnergyData(uint32_t timeMs)
93 generates(fmq_unsync<EnergyData> mqDesc, uint32_t numSamples,
94 uint32_t railsPerSample, Status status);
95};