OLD | NEW |
(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 #include "components/metrics/single_value_counts_histogram.h" |
| 6 |
| 7 #include "base/metrics/histogram.h" |
| 8 |
| 9 namespace metrics { |
| 10 |
| 11 SingleValueCountsHistogram::SingleValueCountsHistogram( |
| 12 const std::string& name, |
| 13 base::HistogramBase::Sample min, |
| 14 base::HistogramBase::Sample max, |
| 15 uint32_t bucket_count) |
| 16 : histogram_(base::Histogram::FactoryGet( |
| 17 name, |
| 18 min, |
| 19 max, |
| 20 bucket_count, |
| 21 base::HistogramBase::kUmaTargetedHistogramFlag)) { |
| 22 DCHECK(histogram_); |
| 23 LOG(ERROR) << __func__; |
| 24 } |
| 25 |
| 26 SingleValueCountsHistogram::~SingleValueCountsHistogram() { |
| 27 LOG(ERROR) << __func__; |
| 28 if (sample_ < 0) |
| 29 return; |
| 30 histogram_->Add(sample_); |
| 31 } |
| 32 |
| 33 void SingleValueCountsHistogram::SetSample(base::HistogramBase::Sample sample) { |
| 34 sample_ = sample; |
| 35 } |
| 36 |
| 37 } // namespace metrics |
OLD | NEW |