/frameworks/base/cmds/statsd/tests/anomaly/ |
D | AnomalyTracker_test.cpp | 128 AnomalyTracker anomalyTracker(alert, kConfigKey); in TEST() local 150 EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 0u); in TEST() 151 EXPECT_EQ(anomalyTracker.mMostRecentBucketNum, -1LL); in TEST() 154 EXPECT_TRUE(detectAnomaliesPass(anomalyTracker, 0, bucket0, {}, {keyA, keyB, keyC})); in TEST() 155 detectAndDeclareAnomalies(anomalyTracker, 0, bucket0, eventTimestamp1); in TEST() 156 checkRefractoryTimes(anomalyTracker, eventTimestamp0, refractoryPeriodSec, in TEST() 160 anomalyTracker.addPastBucket(bucket0, 0); in TEST() 161 EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 3u); in TEST() 162 EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyA), 1LL); in TEST() 163 EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyB), 2LL); in TEST() [all …]
|
/frameworks/base/cmds/statsd/tests/e2e/ |
D | Anomaly_duration_sum_e2e_test.cpp | 109 sp<AnomalyTracker> anomalyTracker = in TEST() local 123 anomalyTracker->getAlarmTimestampSec(dimensionKey)); in TEST() 124 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey)); in TEST() 129 EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey)); in TEST() 130 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey)); in TEST() 136 anomalyTracker->getAlarmTimestampSec(dimensionKey)); in TEST() 137 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey)); in TEST() 143 EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey)); in TEST() 145 anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey)); in TEST() 153 const int64_t alarmFiredTimestampSec0 = anomalyTracker->getAlarmTimestampSec(dimensionKey); in TEST() [all …]
|
D | Anomaly_count_e2e_test.cpp | 73 sp<AnomalyTracker> anomalyTracker = in TEST() local 98 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1)); in TEST() 102 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2)); in TEST() 106 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1)); in TEST() 110 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2)); in TEST() 114 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1)); in TEST() 118 EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2)); in TEST() 124 anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1)); in TEST() 129 anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1)); in TEST() 134 anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1)); in TEST() [all …]
|
/frameworks/base/cmds/statsd/src/metrics/duration_helper/ |
D | DurationTracker.h | 110 virtual int64_t predictAnomalyTimestampNs(const DurationAnomalyTracker& anomalyTracker, 126 for (auto& anomalyTracker : mAnomalyTrackers) { in startAnomalyAlarm() 127 if (anomalyTracker != nullptr) { in startAnomalyAlarm() 129 predictAnomalyTimestampNs(*anomalyTracker, eventTime); in startAnomalyAlarm() 131 anomalyTracker->startAlarm(mEventKey, alarmTimestampNs); in startAnomalyAlarm() 139 for (auto& anomalyTracker : mAnomalyTrackers) { in stopAnomalyAlarm() 140 if (anomalyTracker != nullptr) { in stopAnomalyAlarm() 141 anomalyTracker->stopAlarm(mEventKey, timestamp); in stopAnomalyAlarm() 147 for (auto& anomalyTracker : mAnomalyTrackers) { in addPastBucketToAnomalyTrackers() 148 if (anomalyTracker != nullptr) { in addPastBucketToAnomalyTrackers() [all …]
|
D | OringDurationTracker.cpp | 328 const DurationAnomalyTracker& anomalyTracker, const int64_t eventTimestampNs) const { in predictAnomalyTimestampNs() argument 331 const int64_t thresholdNs = anomalyTracker.getAnomalyThreshold(); in predictAnomalyTimestampNs() 341 int64_t pastNs = currentBucketPastNs + anomalyTracker.getSumOverPastBuckets(mEventKey); in predictAnomalyTimestampNs() 345 anomalyTracker.getRefractoryPeriodEndsSec(mEventKey) * NS_PER_SEC; in predictAnomalyTimestampNs() 357 if (anomalyTracker.getNumOfPastBuckets() > 0) { in predictAnomalyTimestampNs() 358 pastNs -= anomalyTracker.getPastBucketValue( in predictAnomalyTimestampNs() 360 mCurrentBucketNum - anomalyTracker.getNumOfPastBuckets()); in predictAnomalyTimestampNs() 370 for (int futureBucketIdx = 1; futureBucketIdx <= anomalyTracker.getNumOfPastBuckets() + 1; in predictAnomalyTimestampNs() 383 if (anomalyTracker.getNumOfPastBuckets() <= 0) { in predictAnomalyTimestampNs() 395 if (futureBucketIdx < anomalyTracker.getNumOfPastBuckets()) { in predictAnomalyTimestampNs() [all …]
|
D | MaxDurationTracker.cpp | 316 int64_t MaxDurationTracker::predictAnomalyTimestampNs(const DurationAnomalyTracker& anomalyTracker, in predictAnomalyTimestampNs() argument 330 int64_t anomalyTimeNs = currentTimestamp + anomalyTracker.getAnomalyThreshold() - maxElapsed; in predictAnomalyTimestampNs() 331 int64_t refractoryEndNs = anomalyTracker.getRefractoryPeriodEndsSec(mEventKey) * NS_PER_SEC; in predictAnomalyTimestampNs()
|
D | MaxDurationTracker.h | 59 int64_t predictAnomalyTimestampNs(const DurationAnomalyTracker& anomalyTracker,
|
D | OringDurationTracker.h | 57 int64_t predictAnomalyTimestampNs(const DurationAnomalyTracker& anomalyTracker,
|
/frameworks/base/cmds/statsd/tests/metrics/ |
D | OringDurationTracker_test.cpp | 325 sp<DurationAnomalyTracker> anomalyTracker = in TEST() local 329 bucketSizeNs, true, false, {anomalyTracker}); in TEST() 334 tracker.predictAnomalyTimestampNs(*anomalyTracker, eventStartTimeNs)); in TEST() 343 tracker.predictAnomalyTimestampNs(*anomalyTracker, event1StartTimeNs)); in TEST() 362 tracker.predictAnomalyTimestampNs(*anomalyTracker, event2StartTimeNs)); in TEST() 370 tracker.predictAnomalyTimestampNs(*anomalyTracker, event3StartTimeNs)); in TEST() 387 sp<DurationAnomalyTracker> anomalyTracker = in TEST() local 392 bucketSizeNs, true, false, {anomalyTracker}); in TEST() 398 tracker.predictAnomalyTimestampNs(*anomalyTracker, eventStartTimeNs)); in TEST() 403 anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() [all …]
|
D | MaxDurationTracker_test.cpp | 274 sp<DurationAnomalyTracker> anomalyTracker = in TEST() local 278 true, false, {anomalyTracker}); in TEST() 281 sp<const InternalAlarm> alarm = anomalyTracker->mAlarms.begin()->second; in TEST() 286 EXPECT_EQ(0U, anomalyTracker->mAlarms.size()); in TEST() 290 EXPECT_EQ(1U, anomalyTracker->mAlarms.size()); in TEST() 291 alarm = anomalyTracker->mAlarms.begin()->second; in TEST() 334 sp<DurationAnomalyTracker> anomalyTracker = in TEST() local 338 true, false, {anomalyTracker}); in TEST() 345 EXPECT_EQ(1U, anomalyTracker->mAlarms.size()); in TEST() 346 auto alarm = anomalyTracker->mAlarms.begin()->second; in TEST() [all …]
|
D | CountMetricProducer_test.cpp | 236 sp<AnomalyTracker> anomalyTracker = countProducer.addAnomalyTracker(alert, alarmMonitor); in TEST() local 237 EXPECT_TRUE(anomalyTracker != nullptr); in TEST() 242 EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 254 EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 264 EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 273 EXPECT_EQ(2, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 350 sp<AnomalyTracker> anomalyTracker = countProducer.addAnomalyTracker(alert, alarmMonitor); in TEST() local 374 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U); in TEST() 380 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U); in TEST() 389 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), in TEST() [all …]
|
D | GaugeMetricProducer_test.cpp | 216 sp<AnomalyTracker> anomalyTracker = gaugeProducer.addAnomalyTracker(alert, alarmMonitor); in TEST() local 217 EXPECT_TRUE(anomalyTracker != nullptr); in TEST() 232 EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 244 EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 256 EXPECT_EQ(1, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 267 EXPECT_EQ(2, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST() 595 sp<AnomalyTracker> anomalyTracker = gaugeProducer.addAnomalyTracker(alert, alarmMonitor); in TEST() local 609 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U); in TEST() 623 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), in TEST() 638 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), in TEST()
|
D | DurationMetricProducer_test.cpp | 325 sp<AnomalyTracker> anomalyTracker = durationProducer.addAnomalyTracker(alert, alarmMonitor); in TEST() local 326 EXPECT_TRUE(anomalyTracker != nullptr); in TEST() 338 anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY)); in TEST()
|
D | ValueMetricProducer_test.cpp | 977 sp<AnomalyTracker> anomalyTracker = valueProducer.addAnomalyTracker(alert, alarmMonitor); in TEST() local 1015 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U); in TEST() 1020 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U); in TEST() 1025 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), in TEST() 1029 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), in TEST() 1034 EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), in TEST()
|
/frameworks/base/cmds/statsd/src/metrics/ |
D | MetricProducer.h | 180 sp<AnomalyTracker> anomalyTracker = new AnomalyTracker(alert, mConfigKey); in addAnomalyTracker() local 181 if (anomalyTracker != nullptr) { in addAnomalyTracker() 182 mAnomalyTrackers.push_back(anomalyTracker); in addAnomalyTracker() 184 return anomalyTracker; in addAnomalyTracker()
|
D | DurationMetricProducer.cpp | 153 sp<DurationAnomalyTracker> anomalyTracker = in addAnomalyTracker() local 155 if (anomalyTracker != nullptr) { in addAnomalyTracker() 156 mAnomalyTrackers.push_back(anomalyTracker); in addAnomalyTracker() 158 return anomalyTracker; in addAnomalyTracker()
|
D | metrics_manager_util.cpp | 630 sp<AnomalyTracker> anomalyTracker = metric->addAnomalyTracker(alert, anomalyAlarmMonitor); in initAlerts() local 631 if (anomalyTracker == nullptr) { in initAlerts() 636 allAnomalyTrackers.push_back(anomalyTracker); in initAlerts()
|