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

Commit 4481c7c2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adjust 1st bucket start time"

parents ac70654f e1361ed4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ public:

    virtual ~StatsPuller() {}

    // Pulls the data. The returned data will have elapsedTimeNs set as timeNs
    // and will have wallClockTimeNs set as current wall clock time.
    bool Pull(const int64_t timeNs, std::vector<std::shared_ptr<LogEvent>>* data);

    // Clear cache immediately
+8 −0
Original line number Diff line number Diff line
@@ -53,9 +53,12 @@ public:
    virtual ~StatsPullerManager() {
    }

    // Registers a receiver for tagId. It will be pulled on the nextPullTimeNs
    // and then every intervalNs thereafter.
    virtual void RegisterReceiver(int tagId, wp<PullDataReceiver> receiver, int64_t nextPullTimeNs,
                                  int64_t intervalNs);

    // Stop listening on a tagId.
    virtual void UnRegisterReceiver(int tagId, wp<PullDataReceiver> receiver);

    // Verify if we know how to pull for this matcher
@@ -63,11 +66,16 @@ public:

    void OnAlarmFired(const int64_t timeNs);

    // Use respective puller to pull the data. The returned data will have
    // elapsedTimeNs set as timeNs and will have wallClockTimeNs set as current
    // wall clock time.
    virtual bool Pull(const int tagId, const int64_t timeNs,
                      vector<std::shared_ptr<LogEvent>>* data);

    // Clear pull data cache immediately.
    int ForceClearPullerCache();

    // Clear pull data cache if it is beyond respective cool down time.
    int ClearPullerCacheIfNecessary(int64_t timestampNs);

    void SetStatsCompanionService(sp<IStatsCompanionService> statsCompanionService);
+6 −2
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ const int FIELD_ID_END_BUCKET_ELAPSED_MILLIS = 6;
CountMetricProducer::CountMetricProducer(const ConfigKey& key, const CountMetric& metric,
                                         const int conditionIndex,
                                         const sp<ConditionWizard>& wizard,
                                         const int64_t startTimeNs)
    : MetricProducer(metric.id(), key, startTimeNs, conditionIndex, wizard) {
                                         const int64_t timeBaseNs, const int64_t startTimeNs)
    : MetricProducer(metric.id(), key, timeBaseNs, conditionIndex, wizard) {
    if (metric.has_bucket()) {
        mBucketSizeNs =
                TimeUnitToBucketSizeInMillisGuardrailed(key.GetUid(), metric.bucket()) * 1000000;
@@ -100,6 +100,10 @@ CountMetricProducer::CountMetricProducer(const ConfigKey& key, const CountMetric

    mConditionSliced = (metric.links().size() > 0) || (mDimensionsInCondition.size() > 0);

    flushIfNeededLocked(startTimeNs);
    // Adjust start for partial bucket
    mCurrentBucketStartTimeNs = startTimeNs;

    VLOG("metric %lld created. bucket size %lld start_time: %lld", (long long)metric.id(),
         (long long)mBucketSizeNs, (long long)mTimeBaseNs);
}
+2 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ class CountMetricProducer : public MetricProducer {
public:
    CountMetricProducer(const ConfigKey& key, const CountMetric& countMetric,
                        const int conditionIndex, const sp<ConditionWizard>& wizard,
                        const int64_t startTimeNs);
                        const int64_t timeBaseNs, const int64_t startTimeNs);

    virtual ~CountMetricProducer();

@@ -98,6 +98,7 @@ private:
    FRIEND_TEST(CountMetricProducerTest, TestAnomalyDetectionUnSliced);
    FRIEND_TEST(CountMetricProducerTest, TestEventWithAppUpgrade);
    FRIEND_TEST(CountMetricProducerTest, TestEventWithAppUpgradeInNextBucket);
    FRIEND_TEST(CountMetricProducerTest, TestFirstBucket);
};

}  // namespace statsd
+5 −2
Original line number Diff line number Diff line
@@ -68,8 +68,8 @@ DurationMetricProducer::DurationMetricProducer(const ConfigKey& key, const Durat
                                               const bool nesting,
                                               const sp<ConditionWizard>& wizard,
                                               const FieldMatcher& internalDimensions,
                                               const int64_t startTimeNs)
    : MetricProducer(metric.id(), key, startTimeNs, conditionIndex, wizard),
                                               const int64_t timeBaseNs, const int64_t startTimeNs)
    : MetricProducer(metric.id(), key, timeBaseNs, conditionIndex, wizard),
      mAggregationType(metric.aggregation_type()),
      mStartIndex(startIndex),
      mStopIndex(stopIndex),
@@ -128,6 +128,9 @@ DurationMetricProducer::DurationMetricProducer(const ConfigKey& key, const Durat
                                               mMetric2ConditionLinks.begin()->conditionFields);
        }
    }
    flushIfNeededLocked(startTimeNs);
    // Adjust start for partial bucket
    mCurrentBucketStartTimeNs = startTimeNs;
    VLOG("metric %lld created. bucket size %lld start_time: %lld", (long long)metric.id(),
         (long long)mBucketSizeNs, (long long)mTimeBaseNs);
}
Loading