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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 virtual ~HistogramBase(); | 98 virtual ~HistogramBase(); |
99 | 99 |
100 const std::string& histogram_name() const { return histogram_name_; } | 100 const std::string& histogram_name() const { return histogram_name_; } |
101 | 101 |
102 // Comapres |name| to the histogram name and triggers a DCHECK if they do not | 102 // Comapres |name| to the histogram name and triggers a DCHECK if they do not |
103 // match. This is a helper function used by histogram macros, which results in | 103 // match. This is a helper function used by histogram macros, which results in |
104 // in more compact machine code being generated by the macros. | 104 // in more compact machine code being generated by the macros. |
105 void CheckName(const StringPiece& name) const; | 105 void CheckName(const StringPiece& name) const; |
106 | 106 |
107 // Operations with Flags enum. | 107 // Operations with Flags enum. |
108 int32_t flags() const { return flags_; } | 108 int32_t flags() const { return subtle::NoBarrier_Load(&flags_); } |
109 void SetFlags(int32_t flags); | 109 void SetFlags(int32_t flags); |
110 void ClearFlags(int32_t flags); | 110 void ClearFlags(int32_t flags); |
111 | 111 |
112 virtual HistogramType GetHistogramType() const = 0; | 112 virtual HistogramType GetHistogramType() const = 0; |
113 | 113 |
114 // Whether the histogram has construction arguments as parameters specified. | 114 // Whether the histogram has construction arguments as parameters specified. |
115 // For histograms that don't have the concept of minimum, maximum or | 115 // For histograms that don't have the concept of minimum, maximum or |
116 // bucket_count, this function always returns false. | 116 // bucket_count, this function always returns false. |
117 virtual bool HasConstructionArguments(Sample expected_minimum, | 117 virtual bool HasConstructionArguments(Sample expected_minimum, |
118 Sample expected_maximum, | 118 Sample expected_maximum, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void WriteAsciiBucketValue(Count current, | 182 void WriteAsciiBucketValue(Count current, |
183 double scaled_sum, | 183 double scaled_sum, |
184 std::string* output) const; | 184 std::string* output) const; |
185 | 185 |
186 // Retrieves the callback for this histogram, if one exists, and runs it | 186 // Retrieves the callback for this histogram, if one exists, and runs it |
187 // passing |sample| as the parameter. | 187 // passing |sample| as the parameter. |
188 void FindAndRunCallback(Sample sample) const; | 188 void FindAndRunCallback(Sample sample) const; |
189 | 189 |
190 private: | 190 private: |
191 const std::string histogram_name_; | 191 const std::string histogram_name_; |
192 int32_t flags_; | 192 AtomicCount flags_; |
193 | 193 |
194 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 194 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
195 }; | 195 }; |
196 | 196 |
197 } // namespace base | 197 } // namespace base |
198 | 198 |
199 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 199 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |