diff --git a/powerstats/Gs201CommonDataProviders.cpp b/powerstats/Gs201CommonDataProviders.cpp index 151ee627..d6f1af58 100644 --- a/powerstats/Gs201CommonDataProviders.cpp +++ b/powerstats/Gs201CommonDataProviders.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include +using aidl::android::hardware::power::stats::AdaptiveDvfsStateResidencyDataProvider; using aidl::android::hardware::power::stats::AocTimedStateResidencyDataProvider; using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider; using aidl::android::hardware::power::stats::DvfsStateResidencyDataProvider; @@ -166,6 +168,15 @@ void addAoC(std::shared_ptr p) { void addDvfsStats(std::shared_ptr p) { // A constant to represent the number of nanoseconds in one millisecond const int NS_TO_MS = 1000000; + std::string path = "/sys/devices/platform/acpm_stats/fvp_stats"; + + std::vector> adpCfgs = { + std::make_pair("CL0", "/sys/devices/system/cpu/cpufreq/policy0/stats"), + std::make_pair("CL1", "/sys/devices/system/cpu/cpufreq/policy4/stats"), + std::make_pair("CL2", "/sys/devices/system/cpu/cpufreq/policy6/stats") + }; + p->addStateResidencyDataProvider(std::make_unique( + path, NS_TO_MS, adpCfgs)); std::vector cfgs; @@ -187,7 +198,7 @@ void addDvfsStats(std::shared_ptr p) { }}); p->addStateResidencyDataProvider(std::make_unique( - "/sys/devices/platform/acpm_stats/fvp_stats", NS_TO_MS, cfgs)); + path, NS_TO_MS, cfgs)); } void addSoC(std::shared_ptr p) { @@ -523,18 +534,6 @@ void addPowerDomains(std::shared_ptr p) { } void addDevfreq(std::shared_ptr p) { - p->addStateResidencyDataProvider(std::make_unique( - "CL0", - "/sys/devices/system/cpu/cpufreq/policy0/stats")); - - p->addStateResidencyDataProvider(std::make_unique( - "CL1", - "/sys/devices/system/cpu/cpufreq/policy4/stats")); - - p->addStateResidencyDataProvider(std::make_unique( - "CL2", - "/sys/devices/system/cpu/cpufreq/policy6/stats")); - p->addStateResidencyDataProvider(std::make_unique( "MIF", "/sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif"));