| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_VIDEO_STATS_COUNTER_H_ | 11 #ifndef WEBRTC_VIDEO_STATS_COUNTER_H_ |
| 12 #define WEBRTC_VIDEO_STATS_COUNTER_H_ | 12 #define WEBRTC_VIDEO_STATS_COUNTER_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> |
| 15 | 16 |
| 16 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
| 18 | 19 |
| 19 namespace webrtc { | 20 namespace webrtc { |
| 20 | 21 |
| 21 class AggregatedCounter; | 22 class AggregatedCounter; |
| 22 class Clock; | 23 class Clock; |
| 23 class Samples; | 24 class Samples; |
| 24 | 25 |
| 25 // |StatsCounterObserver| is called periodically when a metric is updated. | 26 // |StatsCounterObserver| is called periodically when a metric is updated. |
| 26 class StatsCounterObserver { | 27 class StatsCounterObserver { |
| 27 public: | 28 public: |
| 28 virtual void OnMetricUpdated(int sample) = 0; | 29 virtual void OnMetricUpdated(int sample) = 0; |
| 29 | 30 |
| 30 virtual ~StatsCounterObserver() {} | 31 virtual ~StatsCounterObserver() {} |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 struct AggregatedStats { | 34 struct AggregatedStats { |
| 35 std::string ToString() const; |
| 36 |
| 34 int64_t num_samples = 0; | 37 int64_t num_samples = 0; |
| 35 int min = -1; | 38 int min = -1; |
| 36 int max = -1; | 39 int max = -1; |
| 37 int average = -1; | 40 int average = -1; |
| 38 // TODO(asapersson): Consider adding median/percentiles. | 41 // TODO(asapersson): Consider adding median/percentiles. |
| 39 }; | 42 }; |
| 40 | 43 |
| 41 // Classes which periodically computes a metric. | 44 // Classes which periodically computes a metric. |
| 42 // | 45 // |
| 43 // During a period, |kProcessIntervalMs|, different metrics can be computed e.g: | 46 // During a period, |kProcessIntervalMs|, different metrics can be computed e.g: |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 private: | 267 private: |
| 265 bool GetMetric(int* metric) const override; | 268 bool GetMetric(int* metric) const override; |
| 266 int GetValueForEmptyInterval() const override; // Returns zero. | 269 int GetValueForEmptyInterval() const override; // Returns zero. |
| 267 | 270 |
| 268 RTC_DISALLOW_COPY_AND_ASSIGN(RateAccCounter); | 271 RTC_DISALLOW_COPY_AND_ASSIGN(RateAccCounter); |
| 269 }; | 272 }; |
| 270 | 273 |
| 271 } // namespace webrtc | 274 } // namespace webrtc |
| 272 | 275 |
| 273 #endif // WEBRTC_VIDEO_STATS_COUNTER_H_ | 276 #endif // WEBRTC_VIDEO_STATS_COUNTER_H_ |
| OLD | NEW |