OLD | NEW |
1 // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 1 // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the LICENSE file in the root of the source | 4 // that can be found in the LICENSE file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 // | 8 // |
9 | 9 |
10 #include "webrtc/system_wrappers/include/metrics_default.h" | 10 #include "webrtc/system_wrappers/include/metrics_default.h" |
11 | 11 |
12 #include "webrtc/base/criticalsection.h" | 12 #include "webrtc/base/criticalsection.h" |
13 #include "webrtc/base/thread_annotations.h" | 13 #include "webrtc/base/thread_annotations.h" |
14 #include "webrtc/system_wrappers/include/metrics.h" | 14 #include "webrtc/system_wrappers/include/metrics.h" |
15 | 15 |
16 // Default implementation of histogram methods for WebRTC clients that do not | 16 // Default implementation of histogram methods for WebRTC clients that do not |
17 // want to provide their own implementation. | 17 // want to provide their own implementation. |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 namespace metrics { | 20 namespace metrics { |
21 class Histogram; | 21 class Histogram; |
22 | 22 |
23 namespace { | 23 namespace { |
24 // Limit for the maximum number of sample values that can be stored. | 24 // Limit for the maximum number of sample values that can be stored. |
25 // TODO(asapersson): Consider using bucket count (and set up | 25 // TODO(asapersson): Consider using bucket count (and set up |
26 // linearly/exponentially spaced buckets) if samples are logged more frequently. | 26 // linearly/exponentially spaced buckets) if samples are logged more frequently. |
27 const int kMaxSampleMapSize = 2000; | 27 const int kMaxSampleMapSize = 300; |
28 | 28 |
29 class RtcHistogram { | 29 class RtcHistogram { |
30 public: | 30 public: |
31 RtcHistogram(const std::string& name, int min, int max, int bucket_count) | 31 RtcHistogram(const std::string& name, int min, int max, int bucket_count) |
32 : min_(min), max_(max), info_(name, min, max, bucket_count) { | 32 : min_(min), max_(max), info_(name, min, max, bucket_count) { |
33 RTC_DCHECK_GT(bucket_count, 0); | 33 RTC_DCHECK_GT(bucket_count, 0); |
34 } | 34 } |
35 | 35 |
36 void Add(int sample) { | 36 void Add(int sample) { |
37 if (sample < min_) | 37 if (sample < min_) |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 return map ? map->NumSamples(name) : 0; | 285 return map ? map->NumSamples(name) : 0; |
286 } | 286 } |
287 | 287 |
288 int MinSample(const std::string& name) { | 288 int MinSample(const std::string& name) { |
289 RtcHistogramMap* map = GetMap(); | 289 RtcHistogramMap* map = GetMap(); |
290 return map ? map->MinSample(name) : -1; | 290 return map ? map->MinSample(name) : -1; |
291 } | 291 } |
292 | 292 |
293 } // namespace metrics | 293 } // namespace metrics |
294 } // namespace webrtc | 294 } // namespace webrtc |
OLD | NEW |