jwd | fbceca60 | 2016-08-02 15:43:08 | [diff] [blame] | 1 | // Copyright 2016 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 "chrome/browser/metrics/sampling_metrics_provider.h" |
| 6 | |
| 7 | #include "base/metrics/sparse_histogram.h" |
| 8 | #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" |
| 9 | #include "components/metrics/metrics_provider.h" |
| 10 | |
| 11 | namespace metrics { |
| 12 | |
| 13 | SamplingMetricsProvider::SamplingMetricsProvider() {} |
| 14 | SamplingMetricsProvider::~SamplingMetricsProvider() {} |
| 15 | |
| 16 | void SamplingMetricsProvider::ProvideStabilityMetrics( |
| 17 | SystemProfileProto* system_profile_proto) { |
| 18 | int sample_rate; |
| 19 | // Only log the sample rate if it's defined. |
| 20 | if (ChromeMetricsServicesManagerClient::GetSamplingRatePerMille( |
| 21 | &sample_rate)) { |
| 22 | base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( |
| 23 | "UMA.SamplingRatePerMille", |
| 24 | base::HistogramBase::kUmaStabilityHistogramFlag); |
| 25 | histogram->Add(sample_rate); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | } // namespace metrics |