Loading cmds/statsd/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ statsd_common_src := \ src/external/KernelUidCpuActiveTimeReader.cpp \ src/external/KernelUidCpuClusterTimeReader.cpp \ src/external/StatsPullerManagerImpl.cpp \ src/external/puller_util.cpp \ src/logd/LogEvent.cpp \ src/logd/LogListener.cpp \ src/logd/LogReader.cpp \ Loading Loading @@ -175,6 +176,7 @@ LOCAL_SRC_FILES := \ tests/AnomalyMonitor_test.cpp \ tests/anomaly/AnomalyTracker_test.cpp \ tests/ConfigManager_test.cpp \ tests/external/puller_util_test.cpp \ tests/indexed_priority_queue_test.cpp \ tests/LogEntryMatcher_test.cpp \ tests/LogReader_test.cpp \ Loading cmds/statsd/src/HashableDimensionKey.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,9 @@ bool MetricDimensionKey::operator<(const MetricDimensionKey& that) const { return toString().compare(that.toString()) < 0; }; bool compareDimensionsValue(const DimensionsValue& s1, const DimensionsValue& s2) { return EqualsTo(s1, s2); } } // namespace statsd } // namespace os } // namespace android No newline at end of file cmds/statsd/src/StatsService.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ StatsService::StatsService(const sp<Looper>& handlerLooper) : mAnomalyMonitor(new AnomalyMonitor(MIN_DIFF_TO_UPDATE_REGISTERED_ALARM_SECS)) { mUidMap = new UidMap(); StatsPuller::SetUidMap(mUidMap); mConfigManager = new ConfigManager(); mProcessor = new StatsLogProcessor(mUidMap, mAnomalyMonitor, time(nullptr), [this](const ConfigKey& key) { sp<IStatsCompanionService> sc = getStatsCompanionService(); Loading cmds/statsd/src/external/StatsPuller.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "StatsPuller.h" #include "guardrail/StatsdStats.h" #include "puller_util.h" namespace android { namespace os { Loading @@ -26,6 +27,9 @@ namespace statsd { using std::lock_guard; sp<UidMap> StatsPuller::mUidMap = nullptr; void StatsPuller::SetUidMap(const sp<UidMap>& 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) { Loading Loading @@ -54,6 +58,7 @@ bool StatsPuller::Pull(std::vector<std::shared_ptr<LogEvent>>* data) { mLastPullTimeSec = curTime; bool ret = PullInternal(&mCachedData); if (ret) { mergeIsolatedUidsToHostUid(mCachedData, mUidMap, mTagId); (*data) = mCachedData; } return ret; Loading cmds/statsd/src/external/StatsPuller.h +10 −3 Original line number Diff line number Diff line Loading @@ -18,11 +18,14 @@ #include <android/os/StatsLogEventWrapper.h> #include <utils/String16.h> #include <utils/RefBase.h> #include <mutex> #include <vector> #include "packages/UidMap.h" #include "logd/LogEvent.h" #include "guardrail/StatsdStats.h" #include "logd/LogEvent.h" #include "puller_util.h" using android::os::StatsLogEventWrapper; Loading @@ -30,7 +33,7 @@ namespace android { namespace os { namespace statsd { class StatsPuller { class StatsPuller : public virtual RefBase { public: StatsPuller(const int tagId); Loading @@ -44,6 +47,8 @@ public: // Clear cache if elapsed time is more than cooldown time int ClearCacheIfNecessary(long timestampSec); static void SetUidMap(const sp<UidMap>& uidMap); protected: // The atom tag id this puller pulls const int mTagId; Loading @@ -67,6 +72,8 @@ private: long mLastPullTimeSec; int clearCache(); static sp<UidMap> mUidMap; }; } // namespace statsd Loading Loading
cmds/statsd/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ statsd_common_src := \ src/external/KernelUidCpuActiveTimeReader.cpp \ src/external/KernelUidCpuClusterTimeReader.cpp \ src/external/StatsPullerManagerImpl.cpp \ src/external/puller_util.cpp \ src/logd/LogEvent.cpp \ src/logd/LogListener.cpp \ src/logd/LogReader.cpp \ Loading Loading @@ -175,6 +176,7 @@ LOCAL_SRC_FILES := \ tests/AnomalyMonitor_test.cpp \ tests/anomaly/AnomalyTracker_test.cpp \ tests/ConfigManager_test.cpp \ tests/external/puller_util_test.cpp \ tests/indexed_priority_queue_test.cpp \ tests/LogEntryMatcher_test.cpp \ tests/LogReader_test.cpp \ Loading
cmds/statsd/src/HashableDimensionKey.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -181,7 +181,9 @@ bool MetricDimensionKey::operator<(const MetricDimensionKey& that) const { return toString().compare(that.toString()) < 0; }; bool compareDimensionsValue(const DimensionsValue& s1, const DimensionsValue& s2) { return EqualsTo(s1, s2); } } // namespace statsd } // namespace os } // namespace android No newline at end of file
cmds/statsd/src/StatsService.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ StatsService::StatsService(const sp<Looper>& handlerLooper) : mAnomalyMonitor(new AnomalyMonitor(MIN_DIFF_TO_UPDATE_REGISTERED_ALARM_SECS)) { mUidMap = new UidMap(); StatsPuller::SetUidMap(mUidMap); mConfigManager = new ConfigManager(); mProcessor = new StatsLogProcessor(mUidMap, mAnomalyMonitor, time(nullptr), [this](const ConfigKey& key) { sp<IStatsCompanionService> sc = getStatsCompanionService(); Loading
cmds/statsd/src/external/StatsPuller.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "StatsPuller.h" #include "guardrail/StatsdStats.h" #include "puller_util.h" namespace android { namespace os { Loading @@ -26,6 +27,9 @@ namespace statsd { using std::lock_guard; sp<UidMap> StatsPuller::mUidMap = nullptr; void StatsPuller::SetUidMap(const sp<UidMap>& 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) { Loading Loading @@ -54,6 +58,7 @@ bool StatsPuller::Pull(std::vector<std::shared_ptr<LogEvent>>* data) { mLastPullTimeSec = curTime; bool ret = PullInternal(&mCachedData); if (ret) { mergeIsolatedUidsToHostUid(mCachedData, mUidMap, mTagId); (*data) = mCachedData; } return ret; Loading
cmds/statsd/src/external/StatsPuller.h +10 −3 Original line number Diff line number Diff line Loading @@ -18,11 +18,14 @@ #include <android/os/StatsLogEventWrapper.h> #include <utils/String16.h> #include <utils/RefBase.h> #include <mutex> #include <vector> #include "packages/UidMap.h" #include "logd/LogEvent.h" #include "guardrail/StatsdStats.h" #include "logd/LogEvent.h" #include "puller_util.h" using android::os::StatsLogEventWrapper; Loading @@ -30,7 +33,7 @@ namespace android { namespace os { namespace statsd { class StatsPuller { class StatsPuller : public virtual RefBase { public: StatsPuller(const int tagId); Loading @@ -44,6 +47,8 @@ public: // Clear cache if elapsed time is more than cooldown time int ClearCacheIfNecessary(long timestampSec); static void SetUidMap(const sp<UidMap>& uidMap); protected: // The atom tag id this puller pulls const int mTagId; Loading @@ -67,6 +72,8 @@ private: long mLastPullTimeSec; int clearCache(); static sp<UidMap> mUidMap; }; } // namespace statsd Loading