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 { | 28 std::string AggregatedStats::ToString() const { |
| 29 return ToStringWithMultiplier(1); |
| 30 } |
| 31 |
| 32 std::string AggregatedStats::ToStringWithMultiplier(int multiplier) const { |
29 std::stringstream ss; | 33 std::stringstream ss; |
30 ss << "periodic_samples:" << num_samples << ", {"; | 34 ss << "periodic_samples:" << num_samples << ", {"; |
31 ss << "min:" << min << ", "; | 35 ss << "min:" << (min * multiplier) << ", "; |
32 ss << "avg:" << average << ", "; | 36 ss << "avg:" << (average * multiplier) << ", "; |
33 ss << "max:" << max << "}"; | 37 ss << "max:" << (max * multiplier) << "}"; |
34 return ss.str(); | 38 return ss.str(); |
35 } | 39 } |
36 | 40 |
37 // Class holding periodically computed metrics. | 41 // Class holding periodically computed metrics. |
38 class AggregatedCounter { | 42 class AggregatedCounter { |
39 public: | 43 public: |
40 AggregatedCounter() : last_sample_(0), sum_samples_(0) {} | 44 AggregatedCounter() : last_sample_(0), sum_samples_(0) {} |
41 ~AggregatedCounter() {} | 45 ~AggregatedCounter() {} |
42 | 46 |
43 void Add(int sample) { | 47 void Add(int sample) { |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 409 |
406 *metric = (diff * 1000 + process_intervals_ms_ / 2) / process_intervals_ms_; | 410 *metric = (diff * 1000 + process_intervals_ms_ / 2) / process_intervals_ms_; |
407 return true; | 411 return true; |
408 } | 412 } |
409 | 413 |
410 int RateAccCounter::GetValueForEmptyInterval() const { | 414 int RateAccCounter::GetValueForEmptyInterval() const { |
411 return 0; | 415 return 0; |
412 } | 416 } |
413 | 417 |
414 } // namespace webrtc | 418 } // namespace webrtc |
OLD | NEW |