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" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // subsequent calls). | 225 // subsequent calls). |
226 Histogram* HistogramFactoryGetEnumeration(const std::string& name, | 226 Histogram* HistogramFactoryGetEnumeration(const std::string& name, |
227 int boundary) { | 227 int boundary) { |
228 RtcHistogramMap* map = GetMap(); | 228 RtcHistogramMap* map = GetMap(); |
229 if (!map) | 229 if (!map) |
230 return nullptr; | 230 return nullptr; |
231 | 231 |
232 return map->GetEnumerationHistogram(name, boundary); | 232 return map->GetEnumerationHistogram(name, boundary); |
233 } | 233 } |
234 | 234 |
235 // Fast path. Adds |sample| to cached |histogram_pointer|. | 235 const std::string& GetHistogramName(Histogram* histogram_pointer) { |
236 void HistogramAdd(Histogram* histogram_pointer, | |
237 const std::string& name, | |
238 int sample) { | |
239 if (!histogram_pointer) | |
240 return; | |
241 | |
242 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer); | 236 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer); |
243 RTC_DCHECK_EQ(name, ptr->name()) << "The name should not vary."; | 237 return ptr->name(); |
244 ptr->Add(sample); | |
245 } | 238 } |
246 | 239 |
247 // Fast path. Adds |sample| to cached |histogram_pointer|. | 240 // Fast path. Adds |sample| to cached |histogram_pointer|. |
248 void HistogramAdd(Histogram* histogram_pointer, int sample) { | 241 void HistogramAdd(Histogram* histogram_pointer, int sample) { |
249 if (!histogram_pointer) | |
250 return; | |
251 | |
252 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer); | 242 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer); |
253 ptr->Add(sample); | 243 ptr->Add(sample); |
254 } | 244 } |
255 | 245 |
256 SampleInfo::SampleInfo(const std::string& name, | 246 SampleInfo::SampleInfo(const std::string& name, |
257 int min, | 247 int min, |
258 int max, | 248 int max, |
259 size_t bucket_count) | 249 size_t bucket_count) |
260 : name(name), min(min), max(max), bucket_count(bucket_count) {} | 250 : name(name), min(min), max(max), bucket_count(bucket_count) {} |
261 | 251 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return map ? map->NumSamples(name) : 0; | 284 return map ? map->NumSamples(name) : 0; |
295 } | 285 } |
296 | 286 |
297 int MinSample(const std::string& name) { | 287 int MinSample(const std::string& name) { |
298 RtcHistogramMap* map = GetMap(); | 288 RtcHistogramMap* map = GetMap(); |
299 return map ? map->MinSample(name) : -1; | 289 return map ? map->MinSample(name) : -1; |
300 } | 290 } |
301 | 291 |
302 } // namespace metrics | 292 } // namespace metrics |
303 } // namespace webrtc | 293 } // namespace webrtc |
OLD | NEW |