powerstats: add UWB state residency am: 2cd57aaf92
Original change: https://googleplex-android-review.googlesource.com/c/device/google/tangorpro/+/20258420 Change-Id: Ia1342bd20abf1d251aca74033a099496c36cfa27 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
cbc6fc7acc
1 changed files with 36 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
||||||
|
|
||||||
#include <dataproviders/DisplayStateResidencyDataProvider.h>
|
#include <dataproviders/DisplayStateResidencyDataProvider.h>
|
||||||
|
#include <dataproviders/GenericStateResidencyDataProvider.h>
|
||||||
#include <dataproviders/PowerStatsEnergyConsumer.h>
|
#include <dataproviders/PowerStatsEnergyConsumer.h>
|
||||||
#include <DevfreqStateResidencyDataProvider.h>
|
#include <DevfreqStateResidencyDataProvider.h>
|
||||||
#include <Gs201CommonDataProviders.h>
|
#include <Gs201CommonDataProviders.h>
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider;
|
using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::EnergyConsumerType;
|
using aidl::android::hardware::power::stats::EnergyConsumerType;
|
||||||
|
using aidl::android::hardware::power::stats::GenericStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
||||||
|
|
||||||
void addDisplay(std::shared_ptr<PowerStats> p) {
|
void addDisplay(std::shared_ptr<PowerStats> p) {
|
||||||
|
@ -85,6 +87,39 @@ void addGPUGs202(std::shared_ptr<PowerStats> p) {
|
||||||
stateCoeffs));
|
stateCoeffs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addUwb(std::shared_ptr<PowerStats> p) {
|
||||||
|
// A constant to represent the number of nanoseconds in one millisecond.
|
||||||
|
const int NS_TO_MS = 1000000;
|
||||||
|
|
||||||
|
// ACPM stats are reported in nanoseconds. The transform function
|
||||||
|
// converts nanoseconds to milliseconds.
|
||||||
|
std::function<uint64_t(uint64_t)> uwbNsToMs = [](uint64_t a) { return a / NS_TO_MS; };
|
||||||
|
const GenericStateResidencyDataProvider::StateResidencyConfig stateConfig = {
|
||||||
|
.entryCountSupported = true,
|
||||||
|
.entryCountPrefix = "count:",
|
||||||
|
.totalTimeSupported = true,
|
||||||
|
.totalTimePrefix = "dur ns:",
|
||||||
|
.totalTimeTransform = uwbNsToMs,
|
||||||
|
.lastEntrySupported = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::vector<std::pair<std::string, std::string>> stateHeaders = {
|
||||||
|
std::make_pair("Off", "Off state:"),
|
||||||
|
std::make_pair("Deep sleep", "Deep sleep state:"),
|
||||||
|
std::make_pair("Run", "Run state:"),
|
||||||
|
std::make_pair("Idle", "Idle state:"),
|
||||||
|
std::make_pair("Tx", "Tx state:"),
|
||||||
|
std::make_pair("Rx", "Rx state:"),
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<GenericStateResidencyDataProvider::PowerEntityConfig> cfgs;
|
||||||
|
cfgs.emplace_back(generateGenericStateResidencyConfigs(stateConfig, stateHeaders),
|
||||||
|
"UWB", "");
|
||||||
|
|
||||||
|
p->addStateResidencyDataProvider(std::make_unique<GenericStateResidencyDataProvider>(
|
||||||
|
"/sys/devices/platform/10db0000.spi/spi_master/spi16/spi16.0/uwb/power_stats", cfgs));
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
||||||
|
|
||||||
|
@ -102,6 +137,7 @@ int main() {
|
||||||
addWifi(p);
|
addWifi(p);
|
||||||
addTPU(p);
|
addTPU(p);
|
||||||
addUfs(p);
|
addUfs(p);
|
||||||
|
addUwb(p);
|
||||||
addPowerDomains(p);
|
addPowerDomains(p);
|
||||||
addDevfreq(p);
|
addDevfreq(p);
|
||||||
addGPUGs202(p);
|
addGPUGs202(p);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue