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

Side by Side Diff: components/metrics/single_value_counts_histogram.cc

Issue 2687583002: Add support for single sample metrics. (Closed)
Patch Set: Redesign! Created 3 years, 8 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 #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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698