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

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

Issue 1256363002: Add support to increase a UMA histogram bucket by an aribitrary integer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing unittests. Created 5 years, 4 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
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 <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
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|.
Alexei Svitkine (slow) 2015/08/04 18:25:12 Mention that the |count| param must be > 0.
127 virtual void AddCount(Sample value, int count) = 0;
128
124 // 2 convenient functions that call Add(Sample). 129 // 2 convenient functions that call Add(Sample).
125 void AddTime(const TimeDelta& time); 130 void AddTime(const TimeDelta& time);
126 void AddBoolean(bool value); 131 void AddBoolean(bool value);
127 132
128 virtual void AddSamples(const HistogramSamples& samples) = 0; 133 virtual void AddSamples(const HistogramSamples& samples) = 0;
129 virtual bool AddSamplesFromPickle(base::PickleIterator* iter) = 0; 134 virtual bool AddSamplesFromPickle(base::PickleIterator* iter) = 0;
130 135
131 // Serialize the histogram info into |pickle|. 136 // Serialize the histogram info into |pickle|.
132 // Note: This only serializes the construction arguments of the histogram, but 137 // Note: This only serializes the construction arguments of the histogram, but
133 // does not serialize the samples. 138 // does not serialize the samples.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 private: 190 private:
186 const std::string histogram_name_; 191 const std::string histogram_name_;
187 int32_t flags_; 192 int32_t flags_;
188 193
189 DISALLOW_COPY_AND_ASSIGN(HistogramBase); 194 DISALLOW_COPY_AND_ASSIGN(HistogramBase);
190 }; 195 };
191 196
192 } // namespace base 197 } // namespace base
193 198
194 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ 199 #endif // BASE_METRICS_HISTOGRAM_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698