powerstats: add new parameter to provide aoc clock
AoC power stats are reported in ticks that are different frequency in different SoC. Bug: 233923713 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: I047d7ae163941c2168dcd8a0ea34da73ab4a8477 Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
parent
7134f571dd
commit
d4cab2b2a6
@ -24,12 +24,12 @@ namespace hardware {
|
|||||||
namespace power {
|
namespace power {
|
||||||
namespace stats {
|
namespace stats {
|
||||||
|
|
||||||
AocStateResidencyDataProvider::AocStateResidencyDataProvider(std::vector<std::pair<std::string,
|
AocStateResidencyDataProvider::AocStateResidencyDataProvider(
|
||||||
std::string>> ids, std::vector<std::pair<std::string, std::string>> states) {
|
std::vector<std::pair<std::string, std::string>> ids,
|
||||||
// AoC stats are reported in ticks of 244.140625ns. The transform
|
std::vector<std::pair<std::string, std::string>> states,
|
||||||
// function converts ticks to milliseconds.
|
const uint64_t aocClock) {
|
||||||
// 1000000 / 244.140625 = 4096.
|
// AoC stats are reported in ticks.
|
||||||
static const uint64_t AOC_CLK = 4096;
|
static const uint64_t AOC_CLK = aocClock;
|
||||||
std::function<uint64_t(uint64_t)> aocTickToMs = [](uint64_t a) { return a / AOC_CLK; };
|
std::function<uint64_t(uint64_t)> aocTickToMs = [](uint64_t a) { return a / AOC_CLK; };
|
||||||
GenericStateResidencyDataProvider::StateResidencyConfig config = {
|
GenericStateResidencyDataProvider::StateResidencyConfig config = {
|
||||||
.entryCountSupported = true,
|
.entryCountSupported = true,
|
||||||
|
@ -28,8 +28,9 @@ namespace stats {
|
|||||||
AocTimedStateResidencyDataProvider::AocTimedStateResidencyDataProvider(
|
AocTimedStateResidencyDataProvider::AocTimedStateResidencyDataProvider(
|
||||||
std::vector<std::pair<std::string, std::string>> ids,
|
std::vector<std::pair<std::string, std::string>> ids,
|
||||||
std::vector<std::pair<std::string, std::string>> states,
|
std::vector<std::pair<std::string, std::string>> states,
|
||||||
const uint64_t timeoutMillis)
|
const uint64_t timeoutMillis,
|
||||||
: AocStateResidencyDataProvider(ids, states) {
|
const uint64_t aocClock)
|
||||||
|
: AocStateResidencyDataProvider(ids, states, aocClock) {
|
||||||
static const uint64_t DEFAULT_MAX_TIME_PER_STATE_MILLIS = 120;
|
static const uint64_t DEFAULT_MAX_TIME_PER_STATE_MILLIS = 120;
|
||||||
|
|
||||||
mTimeoutMillis =
|
mTimeoutMillis =
|
||||||
|
@ -27,7 +27,8 @@ namespace stats {
|
|||||||
class AocStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider {
|
class AocStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider {
|
||||||
public:
|
public:
|
||||||
AocStateResidencyDataProvider(std::vector<std::pair<std::string, std::string>> ids,
|
AocStateResidencyDataProvider(std::vector<std::pair<std::string, std::string>> ids,
|
||||||
std::vector<std::pair<std::string, std::string>> states);
|
std::vector<std::pair<std::string, std::string>> states,
|
||||||
|
const uint64_t aocClock);
|
||||||
~AocStateResidencyDataProvider() = default;
|
~AocStateResidencyDataProvider() = default;
|
||||||
bool getStateResidencies(
|
bool getStateResidencies(
|
||||||
std::unordered_map<std::string, std::vector<StateResidency>> *residencies) override;
|
std::unordered_map<std::string, std::vector<StateResidency>> *residencies) override;
|
||||||
|
@ -39,7 +39,8 @@ class AocTimedStateResidencyDataProvider : public AocStateResidencyDataProvider
|
|||||||
AocTimedStateResidencyDataProvider(
|
AocTimedStateResidencyDataProvider(
|
||||||
std::vector<std::pair<std::string, std::string>> ids,
|
std::vector<std::pair<std::string, std::string>> ids,
|
||||||
std::vector<std::pair<std::string, std::string>> states,
|
std::vector<std::pair<std::string, std::string>> states,
|
||||||
const uint64_t timeoutMillis);
|
const uint64_t timeoutMillis,
|
||||||
|
const uint64_t aocClock);
|
||||||
~AocTimedStateResidencyDataProvider() = default;
|
~AocTimedStateResidencyDataProvider() = default;
|
||||||
|
|
||||||
bool getStateResidencies(
|
bool getStateResidencies(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user