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

Commit a7259abd authored by Chenjie Yu's avatar Chenjie Yu
Browse files

use running sum for ValueMetricProducer bucket

simplify ValueMetricProducer logic for pulled data

Test: unit test
Change-Id: Ic0a21a543166cc5c34c1fa505dba08d1fc2f510a
parent c9f1a9e3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -105,6 +105,11 @@ public:
     */
    void init();

    /**
     * Set timestamp if the original timestamp is missing.
     */
    void setTimestampNs(uint64_t timestampNs) {mTimestampNs = timestampNs;}

private:
    /**
     * Don't copy, it's slower. If we really need this we can add it but let's try to
+1 −1
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ bool CountMetricProducer::hitGuardRailLocked(const HashableDimensionKey& newKey)
void CountMetricProducer::onMatchedLogEventInternalLocked(
        const size_t matcherIndex, const HashableDimensionKey& eventKey,
        const map<string, HashableDimensionKey>& conditionKey, bool condition,
        const LogEvent& event, bool scheduledPull) {
        const LogEvent& event) {
    uint64_t eventTimeNs = event.GetTimestampNs();

    flushIfNeededLocked(eventTimeNs);
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ protected:
    void onMatchedLogEventInternalLocked(
            const size_t matcherIndex, const HashableDimensionKey& eventKey,
            const std::map<std::string, HashableDimensionKey>& conditionKey, bool condition,
            const LogEvent& event, bool scheduledPull) override;
            const LogEvent& event) override;

private:
    void onDumpReportLocked(const uint64_t dumpTimeNs,
+1 −1
Original line number Diff line number Diff line
@@ -251,7 +251,7 @@ bool DurationMetricProducer::hitGuardRailLocked(const HashableDimensionKey& newK
void DurationMetricProducer::onMatchedLogEventInternalLocked(
        const size_t matcherIndex, const HashableDimensionKey& eventKey,
        const map<string, HashableDimensionKey>& conditionKeys, bool condition,
        const LogEvent& event, bool scheduledPull) {
        const LogEvent& event) {
    flushIfNeededLocked(event.GetTimestampNs());

    if (matcherIndex == mStopAllIndex) {
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ protected:
    void onMatchedLogEventInternalLocked(
            const size_t matcherIndex, const HashableDimensionKey& eventKey,
            const std::map<std::string, HashableDimensionKey>& conditionKeys, bool condition,
            const LogEvent& event, bool scheduledPull) override;
            const LogEvent& event) override;

private:
    void onDumpReportLocked(const uint64_t dumpTimeNs,
Loading