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

Commit 01fe46cb authored by tsaichristine's avatar tsaichristine
Browse files

Remove DurationTracker cloning functions

The clone functions are no longer used in DurationMetric. They were
previously used with dimensions_in_condition, which has been deprecated.

Test: bit statsd_test:*
Change-Id: I8c4898da0304973adf12a488c791b007cf5b3ffd
parent 3c5d179a
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -82,8 +82,6 @@ public:

    virtual ~DurationTracker(){};

    virtual unique_ptr<DurationTracker> clone(const int64_t eventTime) = 0;

    virtual void noteStart(const HashableDimensionKey& key, bool condition,
                           const int64_t eventTime, const ConditionKey& conditionKey) = 0;
    virtual void noteStop(const HashableDimensionKey& key, const int64_t eventTime,
+0 −18
Original line number Diff line number Diff line
@@ -37,24 +37,6 @@ MaxDurationTracker::MaxDurationTracker(const ConfigKey& key, const int64_t& id,
                      conditionSliced, fullLink, anomalyTrackers) {
}

unique_ptr<DurationTracker> MaxDurationTracker::clone(const int64_t eventTime) {
    auto clonedTracker = make_unique<MaxDurationTracker>(*this);
    for (auto it = clonedTracker->mInfos.begin(); it != clonedTracker->mInfos.end();) {
        if (it->second.state  != kStopped) {
            it->second.lastStartTime = eventTime;
            it->second.lastDuration = 0;
            it++;
        } else {
            it = clonedTracker->mInfos.erase(it);
        }
    }
    if (clonedTracker->mInfos.empty()) {
        return nullptr;
    } else {
        return clonedTracker;
    }
}

bool MaxDurationTracker::hitGuardRail(const HashableDimensionKey& newKey) {
    // ===========GuardRail==============
    if (mInfos.find(newKey) != mInfos.end()) {
+0 −2
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ public:

    MaxDurationTracker(const MaxDurationTracker& tracker) = default;

    unique_ptr<DurationTracker> clone(const int64_t eventTime) override;

    void noteStart(const HashableDimensionKey& key, bool condition, const int64_t eventTime,
                   const ConditionKey& conditionKey) override;
    void noteStop(const HashableDimensionKey& key, const int64_t eventTime,
+0 −7
Original line number Diff line number Diff line
@@ -38,13 +38,6 @@ OringDurationTracker::OringDurationTracker(
    mLastStartTime = 0;
}

unique_ptr<DurationTracker> OringDurationTracker::clone(const int64_t eventTime) {
    auto clonedTracker = make_unique<OringDurationTracker>(*this);
    clonedTracker->mLastStartTime = eventTime;
    clonedTracker->mDuration = 0;
    return clonedTracker;
}

bool OringDurationTracker::hitGuardRail(const HashableDimensionKey& newKey) {
    // ===========GuardRail==============
    // 1. Report the tuple count if the tuple count > soft limit
+0 −2
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@ public:

    OringDurationTracker(const OringDurationTracker& tracker) = default;

    unique_ptr<DurationTracker> clone(const int64_t eventTime) override;

    void noteStart(const HashableDimensionKey& key, bool condition, const int64_t eventTime,
                   const ConditionKey& conditionKey) override;
    void noteStop(const HashableDimensionKey& key, const int64_t eventTime,