Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 320952bf authored by Olivier Gaillard's avatar Olivier Gaillard
Browse files

Track the number of buckets dropped.

Test: atest statsd_test
Change-Id: I56973d2c87aaed0f1c4a6908682cc54cda39eceb
parent 2d0c0e78
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -443,6 +443,11 @@ void StatsdStats::noteBadValueType(int metricId) {
    getAtomMetricStats(metricId).badValueType++;
}

void StatsdStats::noteBucketDropped(int metricId) {
    lock_guard<std::mutex> lock(mLock);
    getAtomMetricStats(metricId).bucketDropped++;
}

void StatsdStats::noteConditionChangeInNextBucket(int metricId) {
    lock_guard<std::mutex> lock(mLock);
    getAtomMetricStats(metricId).conditionChangeInNextBucket++;
+6 −0
Original line number Diff line number Diff line
@@ -359,6 +359,11 @@ public:
     */
    void noteBadValueType(int atomId);

    /**
     * Buckets were dropped due to reclaim memory.
     */
    void noteBucketDropped(int metricId);

    /**
     * A condition change was too late, arrived in the wrong bucket and was skipped
     */
@@ -414,6 +419,7 @@ public:
        long badValueType = 0;
        long conditionChangeInNextBucket = 0;
        long invalidatedBucket = 0;
        long bucketDropped = 0;
    } AtomMetricStats;

private:
+1 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ void CountMetricProducer::onDumpReportLocked(const int64_t dumpTimeNs,

void CountMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
    flushIfNeededLocked(dropTimeNs);
    StatsdStats::getInstance().noteBucketDropped(mMetricId);
    mPastBuckets.clear();
}

+1 −0
Original line number Diff line number Diff line
@@ -444,6 +444,7 @@ void DurationMetricProducer::onConditionChangedLocked(const bool conditionMet,

void DurationMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
    flushIfNeededLocked(dropTimeNs);
    StatsdStats::getInstance().noteBucketDropped(mMetricId);
    mPastBuckets.clear();
}

+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ EventMetricProducer::~EventMetricProducer() {

void EventMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
    mProto->clear();
    StatsdStats::getInstance().noteBucketDropped(mMetricId);
}

void EventMetricProducer::onSlicedConditionMayChangeLocked(bool overallCondition,
Loading