Loading cmds/statsd/src/StatsLogProcessor.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -74,7 +74,8 @@ StatsLogProcessor::StatsLogProcessor(const sp<UidMap>& uidMap, mAnomalyAlarmMonitor(anomalyAlarmMonitor), mPeriodicAlarmMonitor(periodicAlarmMonitor), mSendBroadcast(sendBroadcast), mTimeBaseSec(timeBaseSec) { mTimeBaseSec(timeBaseSec), mLastLogTimestamp(0) { StatsPullerManager statsPullerManager; statsPullerManager.SetTimeBaseSec(mTimeBaseSec); } Loading Loading @@ -144,9 +145,12 @@ void StatsLogProcessor::onIsolatedUidChangedEventLocked(const LogEvent& event) { } } // TODO: what if statsd service restarts? How do we know what logs are already processed before? void StatsLogProcessor::OnLogEvent(LogEvent* event) { std::lock_guard<std::mutex> lock(mMetricsMutex); if (event->GetElapsedTimestampNs() < mLastLogTimestamp) { return; } mLastLogTimestamp = event->GetElapsedTimestampNs(); StatsdStats::getInstance().noteAtomLogged( event->GetTagId(), event->GetElapsedTimestampNs() / NS_PER_SEC); Loading cmds/statsd/src/StatsLogProcessor.h +2 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,8 @@ private: const long mTimeBaseSec; int64_t mLastLogTimestamp; long mLastPullerCacheClearTimeSec = 0; FRIEND_TEST(StatsLogProcessorTest, TestRateLimitByteSize); Loading Loading
cmds/statsd/src/StatsLogProcessor.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -74,7 +74,8 @@ StatsLogProcessor::StatsLogProcessor(const sp<UidMap>& uidMap, mAnomalyAlarmMonitor(anomalyAlarmMonitor), mPeriodicAlarmMonitor(periodicAlarmMonitor), mSendBroadcast(sendBroadcast), mTimeBaseSec(timeBaseSec) { mTimeBaseSec(timeBaseSec), mLastLogTimestamp(0) { StatsPullerManager statsPullerManager; statsPullerManager.SetTimeBaseSec(mTimeBaseSec); } Loading Loading @@ -144,9 +145,12 @@ void StatsLogProcessor::onIsolatedUidChangedEventLocked(const LogEvent& event) { } } // TODO: what if statsd service restarts? How do we know what logs are already processed before? void StatsLogProcessor::OnLogEvent(LogEvent* event) { std::lock_guard<std::mutex> lock(mMetricsMutex); if (event->GetElapsedTimestampNs() < mLastLogTimestamp) { return; } mLastLogTimestamp = event->GetElapsedTimestampNs(); StatsdStats::getInstance().noteAtomLogged( event->GetTagId(), event->GetElapsedTimestampNs() / NS_PER_SEC); Loading
cmds/statsd/src/StatsLogProcessor.h +2 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,8 @@ private: const long mTimeBaseSec; int64_t mLastLogTimestamp; long mLastPullerCacheClearTimeSec = 0; FRIEND_TEST(StatsLogProcessorTest, TestRateLimitByteSize); Loading