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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 // Whether the histogram has construction arguments as parameters specified. | 115 // Whether the histogram has construction arguments as parameters specified. |
116 // For histograms that don't have the concept of minimum, maximum or | 116 // For histograms that don't have the concept of minimum, maximum or |
117 // bucket_count, this function always returns false. | 117 // bucket_count, this function always returns false. |
118 virtual bool HasConstructionArguments(Sample expected_minimum, | 118 virtual bool HasConstructionArguments(Sample expected_minimum, |
119 Sample expected_maximum, | 119 Sample expected_maximum, |
120 size_t expected_bucket_count) const = 0; | 120 size_t expected_bucket_count) const = 0; |
121 | 121 |
122 virtual void Add(Sample value) = 0; | 122 virtual void Add(Sample value) = 0; |
123 | 123 |
| 124 // In Add function the |value| bucket is increased by one, but in some use |
| 125 // cases we need to increase this value by an arbitrary integer. AddCount |
| 126 // function increases the |value| bucket by |count|. |count| should be greater |
| 127 // than or equal to 1. |
| 128 virtual void AddCount(Sample value, int count) = 0; |
| 129 |
124 // 2 convenient functions that call Add(Sample). | 130 // 2 convenient functions that call Add(Sample). |
125 void AddTime(const TimeDelta& time); | 131 void AddTime(const TimeDelta& time); |
126 void AddBoolean(bool value); | 132 void AddBoolean(bool value); |
127 | 133 |
128 virtual void AddSamples(const HistogramSamples& samples) = 0; | 134 virtual void AddSamples(const HistogramSamples& samples) = 0; |
129 virtual bool AddSamplesFromPickle(base::PickleIterator* iter) = 0; | 135 virtual bool AddSamplesFromPickle(base::PickleIterator* iter) = 0; |
130 | 136 |
131 // Serialize the histogram info into |pickle|. | 137 // Serialize the histogram info into |pickle|. |
132 // Note: This only serializes the construction arguments of the histogram, but | 138 // Note: This only serializes the construction arguments of the histogram, but |
133 // does not serialize the samples. | 139 // does not serialize the samples. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 private: | 191 private: |
186 const std::string histogram_name_; | 192 const std::string histogram_name_; |
187 int32_t flags_; | 193 int32_t flags_; |
188 | 194 |
189 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 195 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
190 }; | 196 }; |
191 | 197 |
192 } // namespace base | 198 } // namespace base |
193 | 199 |
194 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 200 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |