Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
|
Mark P
2016/09/23 19:30:41
Resolve before submitting.
(I see only 4 cases thi
rkaplow
2016/09/26 20:16:09
I think there's a bit of cleanup associated with t
Mark P
2016/09/26 23:06:47
Okay.
| |
| 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 Loading... | |
| 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_ |
| OLD | NEW |