Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: webrtc/system_wrappers/source/metrics_default.cc

Issue 2548463002: Add linearly spaced counting histograms (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/system_wrappers/include/metrics.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // webrtc/system_wrappers/interface/metrics.h. 206 // webrtc/system_wrappers/interface/metrics.h.
207 207
208 // Histogram with exponentially spaced buckets. 208 // Histogram with exponentially spaced buckets.
209 // Creates (or finds) histogram. 209 // Creates (or finds) histogram.
210 // The returned histogram pointer is cached (and used for adding samples in 210 // The returned histogram pointer is cached (and used for adding samples in
211 // subsequent calls). 211 // subsequent calls).
212 Histogram* HistogramFactoryGetCounts(const std::string& name, 212 Histogram* HistogramFactoryGetCounts(const std::string& name,
213 int min, 213 int min,
214 int max, 214 int max,
215 int bucket_count) { 215 int bucket_count) {
216 // TODO(asapersson): Alternative implementation will be needed if this
217 // histogram type should be truly exponential.
218 return HistogramFactoryGetCountsLinear(name, min, max, bucket_count);
219 }
220
221 // Histogram with linearly spaced buckets.
222 // Creates (or finds) histogram.
223 // The returned histogram pointer is cached (and used for adding samples in
224 // subsequent calls).
225 Histogram* HistogramFactoryGetCountsLinear(const std::string& name,
226 int min,
227 int max,
228 int bucket_count) {
216 RtcHistogramMap* map = GetMap(); 229 RtcHistogramMap* map = GetMap();
217 if (!map) 230 if (!map)
218 return nullptr; 231 return nullptr;
219 232
220 return map->GetCountsHistogram(name, min, max, bucket_count); 233 return map->GetCountsHistogram(name, min, max, bucket_count);
221 } 234 }
222 235
223 // Histogram with linearly spaced buckets. 236 // Histogram with linearly spaced buckets.
224 // Creates (or finds) histogram. 237 // Creates (or finds) histogram.
225 // The returned histogram pointer is cached (and used for adding samples in 238 // The returned histogram pointer is cached (and used for adding samples in
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 return map ? map->NumSamples(name) : 0; 298 return map ? map->NumSamples(name) : 0;
286 } 299 }
287 300
288 int MinSample(const std::string& name) { 301 int MinSample(const std::string& name) {
289 RtcHistogramMap* map = GetMap(); 302 RtcHistogramMap* map = GetMap();
290 return map ? map->MinSample(name) : -1; 303 return map ? map->MinSample(name) : -1;
291 } 304 }
292 305
293 } // namespace metrics 306 } // namespace metrics
294 } // namespace webrtc 307 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/system_wrappers/include/metrics.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698