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

Side by Side Diff: webrtc/base/histogram.h

Issue 2654473002: Remove static locals from histograms. (Closed)
Patch Set: use another HistogramBase constructor for enumerations Created 3 years, 10 months 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/base/BUILD.gn ('k') | webrtc/base/histogram.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_BASE_HISTOGRAM_H_
12 #define WEBRTC_BASE_HISTOGRAM_H_
13
14 namespace webrtc {
15 namespace metrics {
16 class Histogram;
17 } // namespace metrics
18 } // namespace webrtc
19
20 namespace rtc {
21
22 class HistogramBase {
23 protected:
24 enum class Type { kCounts, kCountsLinear, kEnumeration };
25
26 HistogramBase(const char* name,
27 Type type,
28 int min,
29 int max,
30 int bucket_count);
31
32 HistogramBase(const char* name, Type type, int boundary);
33
34 void AddSample(int sample) const;
35
36 private:
37 webrtc::metrics::Histogram* histogram_;
38 };
39
40 class Histogram : private HistogramBase {
41 public:
42 Histogram(const char* name, int max);
43 Histogram(const char* name, int min, int max);
44 Histogram(const char* name, int min, int max, int bucket_count);
45
46 using HistogramBase::AddSample;
47 };
48
49 class HistogramLinear : private HistogramBase {
50 public:
51 HistogramLinear(const char* name, int max);
52 HistogramLinear(const char* name, int min, int max);
53 HistogramLinear(const char* name, int min, int max, int bucket_count);
54
55 using HistogramBase::AddSample;
56 };
57
58 class HistogramEnumeration : private HistogramBase {
59 public:
60 HistogramEnumeration(const char* name, int boundary);
61 void AddSample(int sample);
62
63 private:
64 int boundary_;
65 };
66
67 class HistogramBoolean : private HistogramEnumeration {
68 public:
69 explicit HistogramBoolean(const char* name);
70
71 void AddSample(bool sample);
72 };
73
74 class HistogramPercentage : private HistogramEnumeration {
75 public:
76 explicit HistogramPercentage(const char* name);
77
78 using HistogramEnumeration::AddSample;
79 };
80
81 } // namespace rtc
82
83 #endif // WEBRTC_BASE_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « webrtc/base/BUILD.gn ('k') | webrtc/base/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698