From 313fe7709cc3a1902cc3f8ac47148808da5aace5 Mon Sep 17 00:00:00 2001 From: Darren Hsu Date: Wed, 27 Apr 2022 01:24:42 +0800 Subject: [PATCH] powerstats: re-enable AoC power stats reporting with timeout Bug: 219630658 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: Icb1433bed3438ed4525816e3d3be28b4e0261e89 Signed-off-by: Darren Hsu --- powerstats/Gs201CommonDataProviders.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/powerstats/Gs201CommonDataProviders.cpp b/powerstats/Gs201CommonDataProviders.cpp index 6232a6e0..4ce104fb 100644 --- a/powerstats/Gs201CommonDataProviders.cpp +++ b/powerstats/Gs201CommonDataProviders.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ #include #include -using aidl::android::hardware::power::stats::AocStateResidencyDataProvider; +using aidl::android::hardware::power::stats::AocTimedStateResidencyDataProvider; using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider; using aidl::android::hardware::power::stats::DvfsStateResidencyDataProvider; using aidl::android::hardware::power::stats::UfsStateResidencyDataProvider; @@ -102,6 +102,8 @@ void addPlaceholderEnergyConsumers(std::shared_ptr p) { } void addAoC(std::shared_ptr p) { + // When the given timeout is 0, the timeout will be replaced with "120ms * statesCount". + static const uint64_t TIMEOUT_MILLIS = 0; std::string prefix = "/sys/devices/platform/19000000.aoc/control/"; // Add AoC cores (a32, ff1, hf0, and hf1) @@ -113,8 +115,8 @@ void addAoC(std::shared_ptr p) { }; std::vector> coreStates = { {"DWN", "off"}, {"RET", "retention"}, {"WFI", "wfi"}}; - p->addStateResidencyDataProvider(std::make_unique(coreIds, - coreStates)); + p->addStateResidencyDataProvider(std::make_unique(coreIds, + coreStates, TIMEOUT_MILLIS)); // Add AoC voltage stats std::vector> voltageIds = { @@ -125,7 +127,8 @@ void addAoC(std::shared_ptr p) { {"UUD", "ultra_underdrive"}, {"UD", "underdrive"}}; p->addStateResidencyDataProvider( - std::make_unique(voltageIds, voltageStates)); + std::make_unique(voltageIds, voltageStates, + TIMEOUT_MILLIS)); // Add AoC monitor mode std::vector> monitorIds = { @@ -135,7 +138,8 @@ void addAoC(std::shared_ptr p) { {"MON", "mode"}, }; p->addStateResidencyDataProvider( - std::make_unique(monitorIds, monitorStates)); + std::make_unique(monitorIds, monitorStates, + TIMEOUT_MILLIS)); // Add AoC restart count const GenericStateResidencyDataProvider::StateResidencyConfig restartCountConfig = { @@ -642,9 +646,7 @@ void addGs201CommonDataProviders(std::shared_ptr p) { setEnergyMeter(p); addPixelStateResidencyDataProvider(p); - // TODO(b/220032540): Re-enable AoC reporting when AoC long latency issue is fixed or - // the timeout mechanism is merged. - //addAoC(p); + addAoC(p); addDvfsStats(p); addSoC(p); addCPUclusters(p);