| Index: webrtc/base/histogram.h
|
| diff --git a/webrtc/base/histogram.h b/webrtc/base/histogram.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6eda37704e3f5c507825065cc8a8b00f9c882c7b
|
| --- /dev/null
|
| +++ b/webrtc/base/histogram.h
|
| @@ -0,0 +1,83 @@
|
| +/*
|
| + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license
|
| + * that can be found in the LICENSE file in the root of the source
|
| + * tree. An additional intellectual property rights grant can be found
|
| + * in the file PATENTS. All contributing project authors may
|
| + * be found in the AUTHORS file in the root of the source tree.
|
| + */
|
| +
|
| +#ifndef WEBRTC_BASE_HISTOGRAM_H_
|
| +#define WEBRTC_BASE_HISTOGRAM_H_
|
| +
|
| +namespace webrtc {
|
| +namespace metrics {
|
| +class Histogram;
|
| +} // namespace metrics
|
| +} // namespace webrtc
|
| +
|
| +namespace rtc {
|
| +
|
| +class HistogramBase {
|
| + protected:
|
| + enum class Type { kCounts, kCountsLinear, kEnumeration };
|
| +
|
| + HistogramBase(const char* name,
|
| + Type type,
|
| + int min,
|
| + int max,
|
| + int bucket_count);
|
| +
|
| + HistogramBase(const char* name, Type type, int boundary);
|
| +
|
| + void AddSample(int sample) const;
|
| +
|
| + private:
|
| + webrtc::metrics::Histogram* histogram_;
|
| +};
|
| +
|
| +class Histogram : private HistogramBase {
|
| + public:
|
| + Histogram(const char* name, int max);
|
| + Histogram(const char* name, int min, int max);
|
| + Histogram(const char* name, int min, int max, int bucket_count);
|
| +
|
| + using HistogramBase::AddSample;
|
| +};
|
| +
|
| +class HistogramLinear : private HistogramBase {
|
| + public:
|
| + HistogramLinear(const char* name, int max);
|
| + HistogramLinear(const char* name, int min, int max);
|
| + HistogramLinear(const char* name, int min, int max, int bucket_count);
|
| +
|
| + using HistogramBase::AddSample;
|
| +};
|
| +
|
| +class HistogramEnumeration : private HistogramBase {
|
| + public:
|
| + HistogramEnumeration(const char* name, int boundary);
|
| + void AddSample(int sample);
|
| +
|
| + private:
|
| + int boundary_;
|
| +};
|
| +
|
| +class HistogramBoolean : private HistogramEnumeration {
|
| + public:
|
| + explicit HistogramBoolean(const char* name);
|
| +
|
| + void AddSample(bool sample);
|
| +};
|
| +
|
| +class HistogramPercentage : private HistogramEnumeration {
|
| + public:
|
| + explicit HistogramPercentage(const char* name);
|
| +
|
| + using HistogramEnumeration::AddSample;
|
| +};
|
| +
|
| +} // namespace rtc
|
| +
|
| +#endif // WEBRTC_BASE_HISTOGRAM_H_
|
|
|