Index: base/metrics/single_value_histograms.h |
diff --git a/base/metrics/single_value_histograms.h b/base/metrics/single_value_histograms.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e3970067ae0b030f74d7fcc07cec9db5be2a7a78 |
--- /dev/null |
+++ b/base/metrics/single_value_histograms.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_METRICS_SINGLE_VALUE_HISTOGRAMS_H_ |
+#define BASE_METRICS_SINGLE_VALUE_HISTOGRAMS_H_ |
+ |
+#include "base/base_export.h" |
+#include "base/macros.h" |
+#include "base/metrics/histogram_base.h" |
+ |
+namespace base { |
+ |
+// See base/metrics/histograms.h for parameter definitions. Must only be used |
+// and destroyed from the same thread as construction. |
+class BASE_EXPORT SingleValueCountsHistogram { |
Alexei Svitkine (slow)
2017/04/26 18:12:53
The convention we use now in base/metrics/histogra
DaleCurtis
2017/04/29 00:30:35
Done.
|
+ public: |
+ virtual ~SingleValueCountsHistogram() {} |
+ |
+ virtual void SetSample(HistogramBase::Sample sample) = 0; |
+}; |
+ |
+// Factory for creating single value histograms. A single value histogram only |
+// reports its sample once at destruction time. The sample may be changed prior |
+// to destruction using the SetSample() method as many times as desired. |
+class BASE_EXPORT SingleValueHistogramsFactory { |
+ public: |
+ virtual ~SingleValueHistogramsFactory() {} |
+ |
+ static SingleValueHistogramsFactory* Get(); |
+ static void SetFactory(SingleValueHistogramsFactory* factory); |
+ |
+ // Returns a single value histogram for a counts type histogram. Safe to call |
+ // from any thread, the returned class must only be used and destroyed from |
+ // the same thread as construction. |
+ // |
+ // See base/metrics/histograms.h for parameter definitions. |
+ virtual std::unique_ptr<SingleValueCountsHistogram> |
+ CreateSingleValueCountsHistogram(const std::string& name, |
+ HistogramBase::Sample min, |
+ HistogramBase::Sample max, |
+ uint32_t bucket_count) = 0; |
+}; |
+ |
+} // namespace base |
+ |
+#endif // BASE_METRICS_SINGLE_VALUE_HISTOGRAMS_H_ |