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

Side by Side Diff: base/metrics/histogram_base.h

Issue 2361933002: Refactor histogram_macros.h. This improves documentation for the macros in the file, moves LOCAL_* … (Closed)
Patch Set: mpearson comments 2 Created 4 years, 2 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 | « no previous file | base/metrics/histogram_macros.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_ 5 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_
6 #define BASE_METRICS_HISTOGRAM_BASE_H_ 6 #define BASE_METRICS_HISTOGRAM_BASE_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 class BASE_EXPORT HistogramBase { 86 class BASE_EXPORT HistogramBase {
87 public: 87 public:
88 typedef int32_t Sample; // Used for samples. 88 typedef int32_t Sample; // Used for samples.
89 typedef subtle::Atomic32 AtomicCount; // Used to count samples. 89 typedef subtle::Atomic32 AtomicCount; // Used to count samples.
90 typedef int32_t Count; // Used to manipulate counts in temporaries. 90 typedef int32_t Count; // Used to manipulate counts in temporaries.
91 91
92 static const Sample kSampleType_MAX; // INT_MAX 92 static const Sample kSampleType_MAX; // INT_MAX
93 93
94 enum Flags { 94 enum Flags {
95 kNoFlags = 0, 95 kNoFlags = 0x0,
96 96
97 // Histogram should be UMA uploaded. 97 // Histogram should be UMA uploaded.
98 kUmaTargetedHistogramFlag = 0x1, 98 kUmaTargetedHistogramFlag = 0x1,
99 99
100 // Indicates that this is a stability histogram. This flag exists to specify 100 // Indicates that this is a stability histogram. This flag exists to specify
101 // which histograms should be included in the initial stability log. Please 101 // which histograms should be included in the initial stability log. Please
102 // refer to |MetricsService::PrepareInitialStabilityLog|. 102 // refer to |MetricsService::PrepareInitialStabilityLog|.
103 kUmaStabilityHistogramFlag = kUmaTargetedHistogramFlag | 0x2, 103 kUmaStabilityHistogramFlag = kUmaTargetedHistogramFlag | 0x2,
104 104
105 // Indicates that the histogram was pickled to be sent across an IPC 105 // Indicates that the histogram was pickled to be sent across an IPC
106 // Channel. If we observe this flag on a histogram being aggregated into 106 // Channel. If we observe this flag on a histogram being aggregated into
107 // after IPC, then we are running in a single process mode, and the 107 // after IPC, then we are running in a single process mode, and the
108 // aggregation should not take place (as we would be aggregating back into 108 // aggregation should not take place (as we would be aggregating back into
109 // the source histogram!). 109 // the source histogram!).
110 kIPCSerializationSourceFlag = 0x10, 110 kIPCSerializationSourceFlag = 0x10,
111 111
112 // Indicates that a callback exists for when a new sample is recorded on 112 // Indicates that a callback exists for when a new sample is recorded on
113 // this histogram. We store this as a flag with the histogram since 113 // this histogram. We store this as a flag with the histogram since
114 // histograms can be in performance critical code, and this allows us 114 // histograms can be in performance critical code, and this allows us
115 // to shortcut looking up the callback if it doesn't exist. 115 // to shortcut looking up the callback if it doesn't exist.
116 kCallbackExists = 0x20, 116 kCallbackExists = 0x20,
117 117
118 // Indicates that the histogram is held in "persistent" memory and may 118 // Indicates that the histogram is held in "persistent" memory and may
119 // be accessible between processes. This is only possible if such a 119 // be accessible between processes. This is only possible if such a
120 // memory segment has been created/attached, used to create a Persistent- 120 // memory segment has been created/attached, used to create a Persistent-
121 // MemoryAllocator, and that loaded into the Histogram module before this 121 // MemoryAllocator, and that loaded into the Histogram module before this
122 // histogram is created. 122 // histogram is created.
123 kIsPersistent = 0x40, 123 kIsPersistent = 0x40,
124 124
125 // TODO(rkaplow): Look into this, but looks like this is unused and can
126 // be removed.
125 // Only for Histogram and its sub classes: fancy bucket-naming support. 127 // Only for Histogram and its sub classes: fancy bucket-naming support.
126 kHexRangePrintingFlag = 0x8000, 128 kHexRangePrintingFlag = 0x8000,
127 }; 129 };
128 130
129 // Histogram data inconsistency types. 131 // Histogram data inconsistency types.
130 enum Inconsistency : uint32_t { 132 enum Inconsistency : uint32_t {
131 NO_INCONSISTENCIES = 0x0, 133 NO_INCONSISTENCIES = 0x0,
132 RANGE_CHECKSUM_ERROR = 0x1, 134 RANGE_CHECKSUM_ERROR = 0x1,
133 BUCKET_ORDER_ERROR = 0x2, 135 BUCKET_ORDER_ERROR = 0x2,
134 COUNT_HIGH_ERROR = 0x4, 136 COUNT_HIGH_ERROR = 0x4,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 272
271 const std::string histogram_name_; 273 const std::string histogram_name_;
272 AtomicCount flags_; 274 AtomicCount flags_;
273 275
274 DISALLOW_COPY_AND_ASSIGN(HistogramBase); 276 DISALLOW_COPY_AND_ASSIGN(HistogramBase);
275 }; 277 };
276 278
277 } // namespace base 279 } // namespace base
278 280
279 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ 281 #endif // BASE_METRICS_HISTOGRAM_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/histogram_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698