| 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 #include "webrtc/video/stats_counter.h" | 11 #include "webrtc/video/stats_counter.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <limits> | 14 #include <limits> |
| 15 #include <map> | 15 #include <map> |
| 16 | 16 |
| 17 #include "webrtc/base/checks.h" | 17 #include "webrtc/base/checks.h" |
| 18 #include "webrtc/system_wrappers/include/clock.h" | 18 #include "webrtc/system_wrappers/include/clock.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 // Default periodic time interval for processing samples. | 23 // Default periodic time interval for processing samples. |
| 24 const int64_t kDefaultProcessIntervalMs = 2000; | 24 const int64_t kDefaultProcessIntervalMs = 2000; |
| 25 const uint32_t kStreamId0 = 0; | 25 const uint32_t kStreamId0 = 0; |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 std::string AggregatedStats::ToString() const { |
| 29 std::stringstream ss; |
| 30 ss << "periodic_samples:" << num_samples << ", {"; |
| 31 ss << "min:" << min << ", "; |
| 32 ss << "avg:" << average << ", "; |
| 33 ss << "max:" << max << "}"; |
| 34 return ss.str(); |
| 35 } |
| 36 |
| 28 // Class holding periodically computed metrics. | 37 // Class holding periodically computed metrics. |
| 29 class AggregatedCounter { | 38 class AggregatedCounter { |
| 30 public: | 39 public: |
| 31 AggregatedCounter() : last_sample_(0), sum_samples_(0) {} | 40 AggregatedCounter() : last_sample_(0), sum_samples_(0) {} |
| 32 ~AggregatedCounter() {} | 41 ~AggregatedCounter() {} |
| 33 | 42 |
| 34 void Add(int sample) { | 43 void Add(int sample) { |
| 35 last_sample_ = sample; | 44 last_sample_ = sample; |
| 36 sum_samples_ += sample; | 45 sum_samples_ += sample; |
| 37 ++stats_.num_samples; | 46 ++stats_.num_samples; |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 405 |
| 397 *metric = (diff * 1000 + process_intervals_ms_ / 2) / process_intervals_ms_; | 406 *metric = (diff * 1000 + process_intervals_ms_ / 2) / process_intervals_ms_; |
| 398 return true; | 407 return true; |
| 399 } | 408 } |
| 400 | 409 |
| 401 int RateAccCounter::GetValueForEmptyInterval() const { | 410 int RateAccCounter::GetValueForEmptyInterval() const { |
| 402 return 0; | 411 return 0; |
| 403 } | 412 } |
| 404 | 413 |
| 405 } // namespace webrtc | 414 } // namespace webrtc |
| OLD | NEW |