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

Commit 0c980ca3 authored by Christine Tsai's avatar Christine Tsai Committed by Automerger Merge Worker
Browse files

Merge "Fix ValueMetric should only pull on real state changes" into rvc-dev am: 235f1db1

Change-Id: I45b50d06132fd3142c259da3dfce6cc3ec29d0fb
parents 7e547089 235f1db1
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -122,11 +122,11 @@ CountMetricProducer::~CountMetricProducer() {
}
}


void CountMetricProducer::onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
void CountMetricProducer::onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
                                         const HashableDimensionKey& primaryKey, int oldState,
                                         const HashableDimensionKey& primaryKey,
                                         int newState) {
                                         const FieldValue& oldState, const FieldValue& newState) {
    VLOG("CountMetric %lld onStateChanged time %lld, State%d, key %s, %d -> %d",
    VLOG("CountMetric %lld onStateChanged time %lld, State%d, key %s, %d -> %d",
         (long long)mMetricId, (long long)eventTimeNs, atomId, primaryKey.toString().c_str(),
         (long long)mMetricId, (long long)eventTimeNs, atomId, primaryKey.toString().c_str(),
         oldState, newState);
         oldState.mValue.int_value, newState.mValue.int_value);
}
}


void CountMetricProducer::dumpStatesLocked(FILE* out, bool verbose) const {
void CountMetricProducer::dumpStatesLocked(FILE* out, bool verbose) const {
+2 −2
Original line number Original line Diff line number Diff line
@@ -53,8 +53,8 @@ public:
    virtual ~CountMetricProducer();
    virtual ~CountMetricProducer();


    void onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
    void onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
                        const HashableDimensionKey& primaryKey, int oldState,
                        const HashableDimensionKey& primaryKey, const FieldValue& oldState,
                        int newState) override;
                        const FieldValue& newState) override;


protected:
protected:
    void onMatchedLogEventInternalLocked(
    void onMatchedLogEventInternalLocked(
+5 −6
Original line number Original line Diff line number Diff line
@@ -161,13 +161,12 @@ sp<AnomalyTracker> DurationMetricProducer::addAnomalyTracker(


void DurationMetricProducer::onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
void DurationMetricProducer::onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
                                            const HashableDimensionKey& primaryKey,
                                            const HashableDimensionKey& primaryKey,
                                            const int32_t oldState, const int32_t newState) {
                                            const FieldValue& oldState,
    // Create a FieldValue object to hold the new state.
                                            const FieldValue& newState) {
    FieldValue value;
    value.mValue.setInt(newState);
    // Check if this metric has a StateMap. If so, map the new state value to
    // Check if this metric has a StateMap. If so, map the new state value to
    // the correct state group id.
    // the correct state group id.
    mapStateValue(atomId, &value);
    FieldValue newStateCopy = newState;
    mapStateValue(atomId, &newStateCopy);


    flushIfNeededLocked(eventTimeNs);
    flushIfNeededLocked(eventTimeNs);


@@ -185,7 +184,7 @@ void DurationMetricProducer::onStateChanged(const int64_t eventTimeNs, const int
        if (!containsLinkedStateValues(whatIt.first, primaryKey, mMetric2StateLinks, atomId)) {
        if (!containsLinkedStateValues(whatIt.first, primaryKey, mMetric2StateLinks, atomId)) {
            continue;
            continue;
        }
        }
        whatIt.second->onStateChanged(eventTimeNs, atomId, value);
        whatIt.second->onStateChanged(eventTimeNs, atomId, newStateCopy);
    }
    }
}
}


+2 −2
Original line number Original line Diff line number Diff line
@@ -55,8 +55,8 @@ public:
                                         const sp<AlarmMonitor>& anomalyAlarmMonitor) override;
                                         const sp<AlarmMonitor>& anomalyAlarmMonitor) override;


    void onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
    void onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
                        const HashableDimensionKey& primaryKey, const int32_t oldState,
                        const HashableDimensionKey& primaryKey, const FieldValue& oldState,
                        const int32_t newState) override;
                        const FieldValue& newState) override;


protected:
protected:
    void onMatchedLogEventLocked(const size_t matcherIndex, const LogEvent& event) override;
    void onMatchedLogEventLocked(const size_t matcherIndex, const LogEvent& event) override;
+2 −2
Original line number Original line Diff line number Diff line
@@ -182,8 +182,8 @@ public:
    };
    };


    void onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
    void onStateChanged(const int64_t eventTimeNs, const int32_t atomId,
                        const HashableDimensionKey& primaryKey, const int32_t oldState,
                        const HashableDimensionKey& primaryKey, const FieldValue& oldState,
                        const int32_t newState){};
                        const FieldValue& newState){};


    // Output the metrics data to [protoOutput]. All metrics reports end with the same timestamp.
    // Output the metrics data to [protoOutput]. All metrics reports end with the same timestamp.
    // This method clears all the past buckets.
    // This method clears all the past buckets.
Loading