| Index: components/metrics/single_value_counts_histogram.cc
|
| diff --git a/components/metrics/single_value_counts_histogram.cc b/components/metrics/single_value_counts_histogram.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e719d5d0523f242aefdc6e1be71b679a2fda6c22
|
| --- /dev/null
|
| +++ b/components/metrics/single_value_counts_histogram.cc
|
| @@ -0,0 +1,39 @@
|
| +// 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.
|
| +
|
| +#include "components/metrics/single_value_counts_histogram.h"
|
| +
|
| +#include "base/metrics/histogram.h"
|
| +
|
| +namespace metrics {
|
| +
|
| +SingleValueCountsHistogram::SingleValueCountsHistogram(
|
| + const std::string& name,
|
| + base::HistogramBase::Sample min,
|
| + base::HistogramBase::Sample max,
|
| + uint32_t bucket_count)
|
| + : histogram_(base::Histogram::FactoryGet(
|
| + name,
|
| + min,
|
| + max,
|
| + bucket_count,
|
| + base::HistogramBase::kUmaTargetedHistogramFlag)) {
|
| + DCHECK(histogram_);
|
| + LOG(ERROR) << __func__;
|
| +}
|
| +
|
| +SingleValueCountsHistogram::~SingleValueCountsHistogram() {
|
| + if (sample_ < 0) {
|
| + LOG(ERROR) << __func__;
|
| + return;
|
| + }
|
| + LOG(ERROR) << __func__ << " : Recording: " << sample_;
|
| + histogram_->Add(sample_);
|
| +}
|
| +
|
| +void SingleValueCountsHistogram::SetSample(base::HistogramBase::Sample sample) {
|
| + sample_ = sample;
|
| +}
|
| +
|
| +} // namespace metrics
|
|
|