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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 explicit HistogramBase(const std::string& name); | 97 explicit HistogramBase(const std::string& name); |
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 // Get a unique ID for this histogram's samples. |
| 108 virtual uint64_t name_hash() const = 0; |
| 109 |
107 // Operations with Flags enum. | 110 // Operations with Flags enum. |
108 int32_t flags() const { return subtle::NoBarrier_Load(&flags_); } | 111 int32_t flags() const { return subtle::NoBarrier_Load(&flags_); } |
109 void SetFlags(int32_t flags); | 112 void SetFlags(int32_t flags); |
110 void ClearFlags(int32_t flags); | 113 void ClearFlags(int32_t flags); |
111 | 114 |
112 virtual HistogramType GetHistogramType() const = 0; | 115 virtual HistogramType GetHistogramType() const = 0; |
113 | 116 |
114 // Whether the histogram has construction arguments as parameters specified. | 117 // Whether the histogram has construction arguments as parameters specified. |
115 // For histograms that don't have the concept of minimum, maximum or | 118 // For histograms that don't have the concept of minimum, maximum or |
116 // bucket_count, this function always returns false. | 119 // bucket_count, this function always returns false. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 private: | 193 private: |
191 const std::string histogram_name_; | 194 const std::string histogram_name_; |
192 AtomicCount flags_; | 195 AtomicCount flags_; |
193 | 196 |
194 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 197 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
195 }; | 198 }; |
196 | 199 |
197 } // namespace base | 200 } // namespace base |
198 | 201 |
199 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 202 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |