power/stats: Update HIDL to include power stats API

Adding new power.stats HAL api for subsystem low power stats collection that will eventually replace legacy power stats api.

BUG: 117887759
BUG: 111185513
Test: build successfully
Change-Id: I0da4de378ba0b5daeeb5c2b15435a0c22eff08b4
(cherry picked from commit f836c07bda)
Merged-In: I0da4de378ba0b5daeeb5c2b15435a0c22eff08b4
This commit is contained in:
Benjamin Schwartz 2018-10-24 10:22:42 -07:00
parent 3b91fd4ab6
commit 6b8d778c36
3 changed files with 154 additions and 3 deletions

View file

@ -14,9 +14,15 @@ hidl_interface {
"android.hidl.base@1.0",
],
types: [
"Status",
"RailInfo",
"EnergyData",
"PowerEntityInfo",
"PowerEntityStateInfo",
"PowerEntityStateResidencyData",
"PowerEntityStateResidencyResult",
"PowerEntityStateSpace",
"PowerEntityType",
"RailInfo",
"Status",
],
gen_java: false,
}

View file

@ -96,4 +96,67 @@ interface IPowerStats {
streamEnergyData(uint32_t timeMs, uint32_t samplingRate)
generates(fmq_sync<EnergyData> mqDesc, uint32_t numSamples,
uint32_t railsPerSample, Status status);
/**
* PowerEntity information:
* Reports information related to all supported PowerEntity(s) for which
* data is available. A PowerEntity is defined as a platform subsystem,
* peripheral, or power domain that impacts the total device power
* consumption.
*
* @return powerEntityInfos List of information on each PowerEntity
* @return status SUCCESS on success or NOT_SUPPORTED if
* feature is not enabled or FILESYSTEM_ERROR on filesystem nodes
* access error.
*/
getPowerEntityInfo()
generates(vec<PowerEntityInfo> powerEntityInfos, Status status);
/**
* PowerEntity state information:
* Reports the set of power states for which the specified
* PowerEntity(s) provide residency data.
*
* @param powerEntityIds collection of IDs of PowerEntity(s) for which
* state information is requested. PowerEntity name to ID mapping may
* be queried from getPowerEntityInfo(). To get state space
* information for all PowerEntity(s) pass an empty vector.
*
* @return powerEntityStateSpaces PowerEntity state space information for
* each specified PowerEntity.
* @return status SUCCESS if powerEntityStateInfos contains state space
* information for at least one PowerEntity, NOT_SUPPORTED if feature
* is not enabled, INVALID_INPUT if no requested PowerEntity(s)
* provide state space information, FILESYSTEM_ERROR if no state space
* information is returned due to filesystem errors.
*/
getPowerEntityStateInfo(vec<uint32_t> powerEntityIds)
generates(vec<PowerEntityStateSpace> powerEntityStateSpaces,
Status status);
/**
* PowerEntity residencies for low frequency clients:
* Reports accumulated residency data for each specified PowerEntity.
* Each PowerEntity may reside in one of multiple states. It may also
* transition to another state. Residency data is an accumulation of time
* that a specified PowerEntity resided in each of its possible states,
* the number of times that each state was entered, and a timestamp
* corresponding to the last time that state was entered. Data is
* accumulated starting from the last time the PowerEntity was reset.
*
* @param powerEntityId collection of IDs of PowerEntity(s) for which
* residency data is requested. PowerEntity name to ID mapping may
* be queried from getPowerEntityInfo(). To get state residency
* data for all PowerEntity(s) pass an empty vector.
* @return stateResidencyResults state residency data for the
* specified powerEntity(s)
* @return status SUCCESS if stateResidencyResults contains residency
* data for at least one PowerEntity, NOT_SUPPORTED if
* feature is not enabled, INVALID_INPUT if no requested
* PowerEntity(s) provide state residency data, FILESYSTEM_ERROR
* if no data is returned due to filesystem errors.
*/
getPowerEntityStateResidencyData(vec<uint32_t> powerEntityIds)
generates(vec<PowerEntityStateResidencyResult> stateResidencyResults,
Status status);
};

View file

@ -36,7 +36,7 @@ struct RailInfo {
struct EnergyData {
/**
* Index corrensponding to the rail. This index matches
* Index corresponding to the rail. This index matches
* the index returned in RailInfo
*/
uint32_t index;
@ -45,3 +45,85 @@ struct EnergyData {
/** Accumulated energy since device boot in microwatt-seconds (uWs) */
uint64_t energy;
};
enum PowerEntityType : uint32_t {
/**
* A subsystem is a self-contained compute unit. Some examples include
* application processor, DSP, GPU.
*/
SUBSYSTEM = 0,
/**
* A peripheral is an auxiliary device that connects to and works with a
* compute unit. Some examples include simple sensors, camera, display.
*/
PERIPHERAL = 1,
/**
* A power domain is a single subsystem or a collection of subsystems
* that is controlled by a single voltage rail.
*/
POWER_DOMAIN = 2,
};
/**
* PowerEntityInfo contains information, such as the ID, name, and type of a
* given PowerEntity.
*/
struct PowerEntityInfo {
/** ID corresponding to the PowerEntity */
uint32_t powerEntityId;
/**
* Name of the PowerEntity. This is unique and opaque to the
* Android framework
*/
string powerEntityName;
/** Type of the PowerEntity */
PowerEntityType type;
};
struct PowerEntityStateInfo {
/** ID corresponding to the state */
uint32_t powerEntityStateId;
/** Name of the state */
string powerEntityStateName;
};
/**
* PowerEntityStateSpace contains the state space information of a given
* PowerEntity. The state space, is the set of possible states that a given
* PowerEntity provides residency data for.
*/
struct PowerEntityStateSpace {
/** ID of the corresponding PowerEntity */
uint32_t powerEntityId;
/** List of states that the PowerEntity may reside in */
vec<PowerEntityStateInfo> states;
};
/** Contains residency data for a single state */
struct PowerEntityStateResidencyData {
/** ID of the corresponding PowerEntityStateInfo */
uint32_t powerEntityStateId;
/**
* Total time in milliseconds that the corresponding PowerEntity resided
* in this state since the PowerEntity was reset
*/
uint64_t totalTimeInStateMs;
/**
* Total number of times that the state was entered since the corresponding
* PowerEntity was reset
*/
uint64_t totalStateEntryCount;
/**
* Last time this state was entered. Time in milliseconds since the
* corresponding PowerEntity was reset
*/
uint64_t lastEntryTimestampMs;
};
struct PowerEntityStateResidencyResult {
/** ID of the corresponding PowerEntity */
uint32_t powerEntityId;
/** Residency data for each state the PowerEntity's state space */
vec<PowerEntityStateResidencyData> stateResidencyData;
};