From e05c8e777646c51a8fdbda8e2d5ccd35a991d03d Mon Sep 17 00:00:00 2001 From: Chenjie Yu Date: Thu, 8 Mar 2018 12:43:58 -0800 Subject: [PATCH] Remove kPullerCooldownMap from code remove dead code Bug: 74032852 Test: manual test Change-Id: I0da74be21bab5842a89ede2a272094ba5ee33d80 --- cmds/statsd/src/external/StatsPuller.cpp | 7 ++----- cmds/statsd/src/guardrail/StatsdStats.cpp | 12 ------------ cmds/statsd/src/guardrail/StatsdStats.h | 7 ------- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/cmds/statsd/src/external/StatsPuller.cpp b/cmds/statsd/src/external/StatsPuller.cpp index 9513cc521af71..3b0cd349168dc 100644 --- a/cmds/statsd/src/external/StatsPuller.cpp +++ b/cmds/statsd/src/external/StatsPuller.cpp @@ -21,6 +21,7 @@ #include "guardrail/StatsdStats.h" #include "puller_util.h" #include "stats_log_util.h" +#include "StatsPullerManagerImpl.h" namespace android { namespace os { @@ -34,11 +35,7 @@ void StatsPuller::SetUidMap(const sp& uidMap) { mUidMap = uidMap; } // ValueMetric has a minimum bucket size of 10min so that we don't pull too frequently StatsPuller::StatsPuller(const int tagId) : mTagId(tagId) { - if (StatsdStats::kPullerCooldownMap.find(tagId) == StatsdStats::kPullerCooldownMap.end()) { - mCoolDownSec = StatsdStats::kDefaultPullerCooldown; - } else { - mCoolDownSec = StatsdStats::kPullerCooldownMap[tagId]; - } + mCoolDownSec = StatsPullerManagerImpl::kAllPullAtomInfo.find(tagId)->second.coolDownSec; VLOG("Puller for tag %d created. Cooldown set to %ld", mTagId, mCoolDownSec); } diff --git a/cmds/statsd/src/guardrail/StatsdStats.cpp b/cmds/statsd/src/guardrail/StatsdStats.cpp index d626d901cdd09..c6c4d135ad3f1 100644 --- a/cmds/statsd/src/guardrail/StatsdStats.cpp +++ b/cmds/statsd/src/guardrail/StatsdStats.cpp @@ -91,18 +91,6 @@ const int FIELD_ID_UID_MAP_BYTES_USED = 3; const int FIELD_ID_UID_MAP_DROPPED_SNAPSHOTS = 4; const int FIELD_ID_UID_MAP_DROPPED_CHANGES = 5; -std::map StatsdStats::kPullerCooldownMap = { - {android::util::KERNEL_WAKELOCK, 1}, - {android::util::WIFI_BYTES_TRANSFER, 1}, - {android::util::MOBILE_BYTES_TRANSFER, 1}, - {android::util::WIFI_BYTES_TRANSFER_BY_FG_BG, 1}, - {android::util::MOBILE_BYTES_TRANSFER_BY_FG_BG, 1}, - {android::util::SUBSYSTEM_SLEEP_STATE, 1}, - {android::util::CPU_TIME_PER_FREQ, 1}, - {android::util::CPU_TIME_PER_UID, 1}, - {android::util::CPU_TIME_PER_UID_FREQ, 1}, -}; - // TODO: add stats for pulled atoms. StatsdStats::StatsdStats() { mPushedAtomStats.resize(android::util::kMaxPushedAtomId + 1); diff --git a/cmds/statsd/src/guardrail/StatsdStats.h b/cmds/statsd/src/guardrail/StatsdStats.h index c3f401324454c..d05c91b8d1880 100644 --- a/cmds/statsd/src/guardrail/StatsdStats.h +++ b/cmds/statsd/src/guardrail/StatsdStats.h @@ -111,13 +111,6 @@ public: /* Min period between two checks of byte size per config key in nanoseconds. */ static const unsigned long long kMinByteSizeCheckPeriodNs = 10 * NS_PER_SEC; - // Default minimum interval between pulls for an atom. Pullers can return cached values if - // another pull request happens within this interval. - static std::map kPullerCooldownMap; - - // Default cooldown time for a puller - static const long kDefaultPullerCooldown = 1; - // Maximum age (30 days) that files on disk can exist in seconds. static const int kMaxAgeSecond = 60 * 60 * 24 * 30;