From 88f8c4b2b4d43fddf83d25dabc41ae39348d6ee8 Mon Sep 17 00:00:00 2001 From: Darren Hsu Date: Wed, 29 Dec 2021 09:09:02 +0800 Subject: [PATCH] powerstats: remove common data providers in specific directory The common data providers will be moved to gs common directory. So I removed them in this directory and used gs common library to get the APIs. Bug: 206576142 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: I81e7a957490fb563fdf25a6434aaf5e886456c5d Signed-off-by: Darren Hsu --- device.mk | 1 + powerstats/Android.bp | 9 ++ powerstats/AocStateResidencyDataProvider.cpp | 128 --------------- powerstats/AocStateResidencyDataProvider.h | 45 ------ .../DevfreqStateResidencyDataProvider.cpp | 111 ------------- .../DevfreqStateResidencyDataProvider.h | 53 ------- powerstats/DvfsStateResidencyDataProvider.cpp | 149 ------------------ powerstats/DvfsStateResidencyDataProvider.h | 68 -------- powerstats/Gs201CommonDataProviders.cpp | 8 +- powerstats/UfsStateResidencyDataProvider.cpp | 82 ---------- powerstats/UfsStateResidencyDataProvider.h | 52 ------ 11 files changed, 14 insertions(+), 692 deletions(-) delete mode 100644 powerstats/AocStateResidencyDataProvider.cpp delete mode 100644 powerstats/AocStateResidencyDataProvider.h delete mode 100644 powerstats/DevfreqStateResidencyDataProvider.cpp delete mode 100644 powerstats/DevfreqStateResidencyDataProvider.h delete mode 100644 powerstats/DvfsStateResidencyDataProvider.cpp delete mode 100644 powerstats/DvfsStateResidencyDataProvider.h delete mode 100644 powerstats/UfsStateResidencyDataProvider.cpp delete mode 100644 powerstats/UfsStateResidencyDataProvider.h diff --git a/device.mk b/device.mk index 390cc32e..075acf04 100644 --- a/device.mk +++ b/device.mk @@ -42,6 +42,7 @@ PRODUCT_SOONG_NAMESPACES += \ hardware/google/interfaces \ hardware/google/pixel \ device/google/gs201 \ + device/google/gs201/powerstats \ vendor/google/whitechapel/tools \ vendor/google/interfaces \ vendor/google_devices/common/proprietary/confirmatioui_hal \ diff --git a/powerstats/Android.bp b/powerstats/Android.bp index df23609c..3991c149 100644 --- a/powerstats/Android.bp +++ b/powerstats/Android.bp @@ -11,6 +11,14 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + +soong_namespace { + imports: [ + "hardware/google/pixel", + "device/google/gs-common/powerstats", + ], +} + package { // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import @@ -33,6 +41,7 @@ cc_library { ], shared_libs: [ + "android.hardware.power.stats-impl.gs-common", "android.hardware.power.stats-impl.pixel", ], } diff --git a/powerstats/AocStateResidencyDataProvider.cpp b/powerstats/AocStateResidencyDataProvider.cpp deleted file mode 100644 index c64496dd..00000000 --- a/powerstats/AocStateResidencyDataProvider.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "AocStateResidencyDataProvider.h" - -#include - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -AocStateResidencyDataProvider::AocStateResidencyDataProvider(std::vector> ids, std::vector> states) { - // AoC stats are reported in ticks of 244.140625ns. The transform - // function converts ticks to milliseconds. - // 1000000 / 244.140625 = 4096. - static const uint64_t AOC_CLK = 4096; - std::function aocTickToMs = [](uint64_t a) { return a / AOC_CLK; }; - GenericStateResidencyDataProvider::StateResidencyConfig config = { - .entryCountSupported = true, - .entryCountPrefix = "Counter:", - .totalTimeSupported = true, - .totalTimePrefix = "Cumulative time:", - .totalTimeTransform = aocTickToMs, - .lastEntrySupported = true, - .lastEntryPrefix = "Time last entered:", - .lastEntryTransform = aocTickToMs, - }; - for (const auto &id : ids) { - for (const auto &state : states) { - std::vector> aocStateHeaders = { - std::make_pair(state.first, ""), - }; - std::vector cfgs; - cfgs.emplace_back(generateGenericStateResidencyConfigs(config, aocStateHeaders), - id.first, ""); - std::unique_ptr sdp( - new GenericStateResidencyDataProvider(id.second + state.second, cfgs)); - mProviders[id.first].push_back(std::move(sdp)); - } - } -} - -bool AocStateResidencyDataProvider::getStateResidencies( - std::unordered_map> *residencies) { - // States from the same power entity are merged. - bool ret = true; - for (const auto &providerList : mProviders) { - int32_t stateId = 0; - std::string curEntity = providerList.first; - std::vector stateResidencies; - - // Iterate over each provider in the providerList, appending each of the states - for (const auto &provider : providerList.second) { - std::unordered_map> residency; - ret &= provider->getStateResidencies(&residency); - - // Each provider should only return data for curEntity but checking anyway - if (residency.find(curEntity) != residency.end()) { - for (auto &r : residency.at(curEntity)) { - /* - * Modifying stateId here because we are stitching together infos from - * multiple GenericStateResidencyDataProviders. stateId must be modified - * to maintain uniqueness for a given entity - */ - r.id = stateId++; - stateResidencies.push_back(r); - } - } - } - - residencies->emplace(curEntity, stateResidencies); - } - return ret; -} - -std::unordered_map> AocStateResidencyDataProvider::getInfo() { - // States from the same power entity are merged - std::unordered_map> infos; - for (const auto &providerList : mProviders) { - int32_t stateId = 0; - std::string curEntity = providerList.first; - std::vector stateInfos; - - // Iterate over each provider in the providerList, appending each of the states - for (const auto &provider : providerList.second) { - std::unordered_map> info = provider->getInfo(); - - // Each provider should only return data for curEntity but checking anyway - if (info.find(curEntity) != info.end()) { - for (auto &i : info.at(curEntity)) { - /* - * Modifying stateId because we are stitching together infos from - * multiple GenericStateResidencyDataProviders. stateId must be modified - * to maintain uniqueness for a given entity - */ - i.id = stateId++; - stateInfos.push_back(i); - } - } - } - - infos.emplace(curEntity, stateInfos); - } - - return infos; -} - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/powerstats/AocStateResidencyDataProvider.h b/powerstats/AocStateResidencyDataProvider.h deleted file mode 100644 index 50089121..00000000 --- a/powerstats/AocStateResidencyDataProvider.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include -#include - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -class AocStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider { - public: - AocStateResidencyDataProvider(std::vector> ids, - std::vector> states); - ~AocStateResidencyDataProvider() = default; - bool getStateResidencies( - std::unordered_map> *residencies) override; - std::unordered_map> getInfo() override; - - private: - std::unordered_map> /* providers */> mProviders; -}; - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl \ No newline at end of file diff --git a/powerstats/DevfreqStateResidencyDataProvider.cpp b/powerstats/DevfreqStateResidencyDataProvider.cpp deleted file mode 100644 index d59e1e5e..00000000 --- a/powerstats/DevfreqStateResidencyDataProvider.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "DevfreqStateResidencyDataProvider.h" - -#include - -static const std::string nameSuffix = "-DVFS"; -static const std::string pathSuffix = "/time_in_state"; - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -DevfreqStateResidencyDataProvider::DevfreqStateResidencyDataProvider(const std::string& name, - const std::string& path) : mName(name + nameSuffix), mPath(path + pathSuffix) {} - -bool DevfreqStateResidencyDataProvider::extractNum(const char *str, char **str_end, int base, - int64_t* num) { - // errno can be set to any non-zero value by a library function call - // regardless of whether there was an error, so it needs to be cleared - // in order to check the error set by strtoll - errno = 0; - *num = std::strtoll(str, str_end, base); - return (errno != ERANGE); -} - -std::vector> DevfreqStateResidencyDataProvider::parseTimeInState() { - // Using FILE* instead of std::ifstream for performance reasons - std::unique_ptr fp(fopen(mPath.c_str(), "r"), fclose); - if (!fp) { - PLOG(ERROR) << "Failed to open file " << mPath; - return {}; - } - - std::vector> timeInState; - - char *line = nullptr; - size_t len = 0; - while (getline(&line, &len, fp.get()) != -1) { - char* pEnd; - int64_t frequencyHz, totalTimeMs; - if (!extractNum(line, &pEnd, 10, &frequencyHz) || - !extractNum(pEnd, &pEnd, 10, &totalTimeMs)) { - PLOG(ERROR) << "Failed to parse " << mPath; - free(line); - return {}; - } - - timeInState.push_back({frequencyHz, totalTimeMs}); - } - - free(line); - return timeInState; -} - -bool DevfreqStateResidencyDataProvider::getStateResidencies( - std::unordered_map> *residencies) { - std::vector> timeInState = parseTimeInState(); - - if (timeInState.empty()) { - return false; - } - - int32_t id = 0; - std::vector stateResidencies; - for (const auto[frequencyHz, totalTimeMs] : timeInState) { - StateResidency s = {.id = id++, .totalTimeInStateMs = totalTimeMs}; - stateResidencies.push_back(s); - } - - residencies->emplace(mName, stateResidencies); - return true; -} - -std::unordered_map> DevfreqStateResidencyDataProvider::getInfo() { - std::vector> timeInState = parseTimeInState(); - - if (timeInState.empty()) { - return {}; - } - - int32_t id = 0; - std::vector states; - for (const auto[frequencyHz, totalTimeMs] : timeInState) { - State s = {.id = id++, .name = std::to_string(frequencyHz / 1000) + "MHz"}; - states.push_back(s); - } - - return {{mName, states}}; -} - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/powerstats/DevfreqStateResidencyDataProvider.h b/powerstats/DevfreqStateResidencyDataProvider.h deleted file mode 100644 index 8341b433..00000000 --- a/powerstats/DevfreqStateResidencyDataProvider.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -class DevfreqStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider { - public: - DevfreqStateResidencyDataProvider(const std::string& name, const std::string& path); - ~DevfreqStateResidencyDataProvider() = default; - - /* - * See IStateResidencyDataProvider::getStateResidencies - */ - bool getStateResidencies( - std::unordered_map> *residencies) override; - - /* - * See IStateResidencyDataProvider::getInfo - */ - std::unordered_map> getInfo() override; - - private: - bool extractNum(const char *str, char **str_end, int base, int64_t* num); - std::vector> parseTimeInState(); - const std::string mName; - const std::string mPath; -}; - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/powerstats/DvfsStateResidencyDataProvider.cpp b/powerstats/DvfsStateResidencyDataProvider.cpp deleted file mode 100644 index 511159ef..00000000 --- a/powerstats/DvfsStateResidencyDataProvider.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "DvfsStateResidencyDataProvider.h" - -#include -#include -#include - -#include -#include - -using android::base::ParseUint; -using android::base::Split; -using android::base::StartsWith; -using android::base::Trim; - -static const std::string nameSuffix = "-DVFS"; - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -DvfsStateResidencyDataProvider::DvfsStateResidencyDataProvider(std::string path, uint64_t clockRate, - std::vector cfgs) - : mPath(std::move(path)), mClockRate(clockRate), mPowerEntities(std::move(cfgs)) {} - -int32_t DvfsStateResidencyDataProvider::matchEntity(char const *line) { - for (int32_t i = 0; i < mPowerEntities.size(); i++) { - if (mPowerEntities[i].powerEntityName == Trim(std::string(line))) { - return i; - } - } - return -1; -} - -int32_t DvfsStateResidencyDataProvider::matchState(char const *line, const Config& powerEntity) { - for (int32_t i = 0; i < powerEntity.states.size(); i++) { - if (StartsWith(Trim(std::string(line)), powerEntity.states[i].second)) { - return i; - } - } - return -1; -} - -bool DvfsStateResidencyDataProvider::parseState(char const *line, uint64_t *duration, - uint64_t *count) { - std::vector parts = Split(line, " "); - if (parts.size() != 7) { - return false; - } - if (!ParseUint(Trim(parts[3]), count)) { - return false; - } - if (!ParseUint(Trim(parts[6]), duration)) { - return false; - } - return true; -} - -bool DvfsStateResidencyDataProvider::getStateResidencies( - std::unordered_map> *residencies) { - std::unique_ptr fp(fopen(mPath.c_str(), "r"), fclose); - if (!fp) { - PLOG(ERROR) << __func__ << ":Failed to open file " << mPath; - return false; - } - - for (const Config &powerEntity : mPowerEntities) { - std::vector stateResidency(powerEntity.states.size()); - for (int32_t i = 0; i < stateResidency.size(); i++) { - stateResidency[i].id = i; - } - residencies->emplace(powerEntity.powerEntityName + nameSuffix, stateResidency); - } - - size_t len = 0; - char *line = nullptr; - - int32_t temp, powerEntityIndex, stateId = -1; - uint64_t duration, count; - auto it = residencies->end(); - - while (getline(&line, &len, fp.get()) != -1) { - temp = matchEntity(line); - // Assign new index only when a new valid entity is encountered. - if (temp >= 0) { - powerEntityIndex = temp; - it = residencies->find(mPowerEntities[powerEntityIndex].powerEntityName + nameSuffix); - } - - if (it != residencies->end()) { - stateId = matchState(line, mPowerEntities[powerEntityIndex]); - - if (stateId >= 0) { - if (parseState(line, &duration, &count)) { - it->second[stateId].totalTimeInStateMs = - duration / mClockRate; - it->second[stateId].totalStateEntryCount = count; - } else { - LOG(ERROR) << "Failed to parse duration and count from [" << std::string(line) - << "]"; - return false; - } - } - } - } - - free(line); - - return true; -} - -std::unordered_map> DvfsStateResidencyDataProvider::getInfo() { - std::unordered_map> info; - for (auto const &entity : mPowerEntities) { - std::vector stateInfo(entity.states.size()); - int32_t stateId = 0; - for (auto const &state : entity.states) { - stateInfo[stateId] = State{ - .id = stateId, - .name = state.first - }; - stateId++; - } - info.emplace(entity.powerEntityName + nameSuffix, stateInfo); - } - return info; -} - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/powerstats/DvfsStateResidencyDataProvider.h b/powerstats/DvfsStateResidencyDataProvider.h deleted file mode 100644 index ca8ab22b..00000000 --- a/powerstats/DvfsStateResidencyDataProvider.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -class DvfsStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider { - public: - class Config { - public: - // Power entity name to parse. - std::string powerEntityName; - - // List of state pairs (name to display, name to parse). - std::vector> states; - }; - /* - * path - path to dvfs sysfs node. - * clockRate - clock rate in KHz. - */ - DvfsStateResidencyDataProvider(std::string path, uint64_t clockRate, std::vector cfgs); - ~DvfsStateResidencyDataProvider() = default; - - /* - * See IStateResidencyDataProvider::getStateResidencies - */ - bool getStateResidencies( - std::unordered_map> *residencies) override; - - /* - * See IStateResidencyDataProvider::getInfo - */ - std::unordered_map> getInfo() override; - - private: - int32_t matchEntity(char const *line); - int32_t matchState(char const *line, const Config& powerEntity); - bool parseState(char const *line, uint64_t *duration, uint64_t *count); - - const std::string mPath; - const uint64_t mClockRate; - std::vector mPowerEntities; -}; - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/powerstats/Gs201CommonDataProviders.cpp b/powerstats/Gs201CommonDataProviders.cpp index d7e50a72..f0dddcfd 100644 --- a/powerstats/Gs201CommonDataProviders.cpp +++ b/powerstats/Gs201CommonDataProviders.cpp @@ -16,10 +16,10 @@ #include #include -#include "AocStateResidencyDataProvider.h" -#include "DevfreqStateResidencyDataProvider.h" -#include "DvfsStateResidencyDataProvider.h" -#include "UfsStateResidencyDataProvider.h" +#include +#include +#include +#include #include #include #include diff --git a/powerstats/UfsStateResidencyDataProvider.cpp b/powerstats/UfsStateResidencyDataProvider.cpp deleted file mode 100644 index aec77241..00000000 --- a/powerstats/UfsStateResidencyDataProvider.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "UfsStateResidencyDataProvider.h" - -#include -#include -#include - -#include -#include - -using android::base::ParseInt; -using android::base::Split; -using android::base::StartsWith; -using android::base::Trim; - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -const int32_t HIBERNATE_STATE_ID = 0; -const std::string UFS_NAME = "UFS"; - -UfsStateResidencyDataProvider::UfsStateResidencyDataProvider(std::string prefix) : kPrefix(prefix) {} - -bool UfsStateResidencyDataProvider::getStateResidencies( - std::unordered_map> *residencies) { - StateResidency residency; - residency.id = HIBERNATE_STATE_ID; - - // The transform function converts microseconds to milliseconds. - std::function usecToMs = [](uint64_t a) { return a / 1000; }; - - residency.totalTimeInStateMs = usecToMs(readStat(kPrefix + "hibern8_total_us")); - residency.totalStateEntryCount = readStat(kPrefix + "hibern8_exit_cnt"); - residency.lastEntryTimestampMs = usecToMs(readStat(kPrefix + "last_hibern8_enter_time")); - - residencies->emplace(UFS_NAME, std::vector{residency}); - return true; -} - -std::unordered_map> UfsStateResidencyDataProvider::getInfo() { - return {{UFS_NAME, std::vector{{HIBERNATE_STATE_ID, "HIBERN8"}} }}; -} - -int64_t UfsStateResidencyDataProvider::readStat(std::string path) { - std::unique_ptr fp(fopen(path.c_str(), "r"), fclose); - if (!fp) { - PLOG(ERROR) << __func__ << ":Failed to open file " << path - << " Error = " << strerror(errno); - return 0; - } - const size_t size = 20; - char buf[size]; - (void)fread(&buf, sizeof(char), size, fp.get()); - int64_t ret; - if (!ParseInt(Trim(std::string(buf)), &ret)) { - LOG(ERROR) << "Failed to parse int64 from [" << std::string(buf) << "]"; - } - return ret; -} - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/powerstats/UfsStateResidencyDataProvider.h b/powerstats/UfsStateResidencyDataProvider.h deleted file mode 100644 index f4ef268d..00000000 --- a/powerstats/UfsStateResidencyDataProvider.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace stats { - -class UfsStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider { - public: - UfsStateResidencyDataProvider(std::string prefix); - ~UfsStateResidencyDataProvider() = default; - - /* - * See IStateResidencyDataProvider::getStateResidencies - */ - bool getStateResidencies( - std::unordered_map> *residencies) override; - - /* - * See IStateResidencyDataProvider::getInfo - */ - std::unordered_map> getInfo() override; - - private: - int64_t readStat(std::string path); - - const std::string kPrefix; -}; - -} // namespace stats -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl