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

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

Issue 2687583002: Add support for single sample metrics. (Closed)
Patch Set: Use thread local storage. Created 3 years, 7 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_METRICS_SINGLE_VALUE_HISTOGRAMS_H_
6 #define BASE_METRICS_SINGLE_VALUE_HISTOGRAMS_H_
7
8 #include "base/base_export.h"
9 #include "base/macros.h"
10 #include "base/metrics/histogram_base.h"
11
12 namespace base {
13
14 // See base/metrics/histograms.h for parameter definitions. Must only be used
15 // and destroyed from the same thread as construction.
16 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.
17 public:
18 virtual ~SingleValueCountsHistogram() {}
19
20 virtual void SetSample(HistogramBase::Sample sample) = 0;
21 };
22
23 // Factory for creating single value histograms. A single value histogram only
24 // reports its sample once at destruction time. The sample may be changed prior
25 // to destruction using the SetSample() method as many times as desired.
26 class BASE_EXPORT SingleValueHistogramsFactory {
27 public:
28 virtual ~SingleValueHistogramsFactory() {}
29
30 static SingleValueHistogramsFactory* Get();
31 static void SetFactory(SingleValueHistogramsFactory* factory);
32
33 // Returns a single value histogram for a counts type histogram. Safe to call
34 // from any thread, the returned class must only be used and destroyed from
35 // the same thread as construction.
36 //
37 // See base/metrics/histograms.h for parameter definitions.
38 virtual std::unique_ptr<SingleValueCountsHistogram>
39 CreateSingleValueCountsHistogram(const std::string& name,
40 HistogramBase::Sample min,
41 HistogramBase::Sample max,
42 uint32_t bucket_count) = 0;
43 };
44
45 } // namespace base
46
47 #endif // BASE_METRICS_SINGLE_VALUE_HISTOGRAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698