summaryrefslogtreecommitdiffstats
path: root/power
diff options
context:
space:
mode:
authorBenjamin Schwartz <bsschwar@google.com>2018-10-24 10:22:42 -0700
committerBenjamin Schwartz <bsschwar@google.com>2019-01-07 14:00:36 -0800
commit6b8d778c365f898c0990cc8924fd82192ca0c30f (patch)
treefee0f27e43d5119eae0dc8dc53f4b711b1cb870d /power
parent3b91fd4ab6945b44ccb450d963a4dd46bf125a2b (diff)
downloadandroid_hardware_interfaces-6b8d778c365f898c0990cc8924fd82192ca0c30f.tar.gz
android_hardware_interfaces-6b8d778c365f898c0990cc8924fd82192ca0c30f.tar.bz2
android_hardware_interfaces-6b8d778c365f898c0990cc8924fd82192ca0c30f.zip
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 f836c07bda1b3d289425646e9b6a960d5203a9a6) Merged-In: I0da4de378ba0b5daeeb5c2b15435a0c22eff08b4
Diffstat (limited to 'power')
-rw-r--r--power/stats/1.0/Android.bp10
-rw-r--r--power/stats/1.0/IPowerStats.hal63
-rw-r--r--power/stats/1.0/types.hal84
3 files changed, 154 insertions, 3 deletions
diff --git a/power/stats/1.0/Android.bp b/power/stats/1.0/Android.bp
index 2f16a2133..9a956e4ce 100644
--- a/power/stats/1.0/Android.bp
+++ b/power/stats/1.0/Android.bp
@@ -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,
}
diff --git a/power/stats/1.0/IPowerStats.hal b/power/stats/1.0/IPowerStats.hal
index b5b3cc9a8..75c6a72fc 100644
--- a/power/stats/1.0/IPowerStats.hal
+++ b/power/stats/1.0/IPowerStats.hal
@@ -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);
};
diff --git a/power/stats/1.0/types.hal b/power/stats/1.0/types.hal
index 703e5429e..986a6bb1a 100644
--- a/power/stats/1.0/types.hal
+++ b/power/stats/1.0/types.hal
@@ -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;
+};