Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/metrics/metrics_service_base.h" | 5 #include "chrome/common/metrics/metrics_service_base.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 | 8 |
| 9 #include "chrome/common/metrics/metrics_log_base.h" | 9 #include "chrome/common/metrics/metrics_log_base.h" |
| 10 | 10 |
| 11 using base::Histogram; | 11 using base::Histogram; |
| 12 | 12 |
| 13 MetricsServiceBase::MetricsServiceBase() | 13 MetricsServiceBase::MetricsServiceBase() |
| 14 : histogram_snapshot_manager_(this) { | 14 : histogram_snapshot_manager_(this) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 MetricsServiceBase::~MetricsServiceBase() { | 17 MetricsServiceBase::~MetricsServiceBase() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 const char MetricsServiceBase::kServerUrl[] = | 21 const char MetricsServiceBase::kServerUrl[] = |
| 22 "https://clients4.google.com/uma/v2"; | 22 "https://clients4.google.com/uma/v2"; |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 const char MetricsServiceBase::kMimeType[] = "application/vnd.chrome.uma"; | 25 const char MetricsServiceBase::kMimeType[] = "application/vnd.chrome.uma"; |
| 26 | 26 |
| 27 void MetricsServiceBase::RecordCurrentHistograms() { | 27 void MetricsServiceBase::RecordCurrentHistograms() { |
| 28 DCHECK(log_manager_.current_log()); | 28 DCHECK(log_manager_.current_log()); |
| 29 histogram_snapshot_manager_.PrepareDeltas(base::Histogram::kNoFlags, true); | 29 histogram_snapshot_manager_.PrepareDeltas( |
| 30 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag); | |
| 31 } | |
| 32 | |
| 33 void MetricsServiceBase::RecordCurrentStabilityHistograms() { | |
| 34 DCHECK(log_manager_.current_log()); | |
| 35 histogram_snapshot_manager_.PrepareDeltas( | |
| 36 base::Histogram::kNoFlags, | |
| 37 static_cast<base::Histogram::Flags>( | |
|
Alexei Svitkine (slow)
2014/01/27 19:12:54
This cast is kind of ugly, but I understand why it
Kibeom Kim (inactive)
2014/01/29 01:52:32
Done. (nice suggestion!)
| |
| 38 base::Histogram::kUmaTargetedHistogramFlag | | |
| 39 base::Histogram::kStabilityHistogramFlag)); | |
| 30 } | 40 } |
| 31 | 41 |
| 32 void MetricsServiceBase::RecordDelta( | 42 void MetricsServiceBase::RecordDelta( |
| 33 const base::HistogramBase& histogram, | 43 const base::HistogramBase& histogram, |
| 34 const base::HistogramSamples& snapshot) { | 44 const base::HistogramSamples& snapshot) { |
| 35 log_manager_.current_log()->RecordHistogramDelta(histogram.histogram_name(), | 45 log_manager_.current_log()->RecordHistogramDelta(histogram.histogram_name(), |
| 36 snapshot); | 46 snapshot); |
| 37 } | 47 } |
| 38 | 48 |
| 39 void MetricsServiceBase::InconsistencyDetected( | 49 void MetricsServiceBase::InconsistencyDetected( |
| 40 base::HistogramBase::Inconsistency problem) { | 50 base::HistogramBase::Inconsistency problem) { |
| 41 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowser", | 51 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowser", |
| 42 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE); | 52 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE); |
| 43 } | 53 } |
| 44 | 54 |
| 45 void MetricsServiceBase::UniqueInconsistencyDetected( | 55 void MetricsServiceBase::UniqueInconsistencyDetected( |
| 46 base::HistogramBase::Inconsistency problem) { | 56 base::HistogramBase::Inconsistency problem) { |
| 47 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowserUnique", | 57 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowserUnique", |
| 48 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE); | 58 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE); |
| 49 } | 59 } |
| 50 | 60 |
| 51 void MetricsServiceBase::InconsistencyDetectedInLoggedCount(int amount) { | 61 void MetricsServiceBase::InconsistencyDetectedInLoggedCount(int amount) { |
| 52 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotBrowser", | 62 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotBrowser", |
| 53 std::abs(amount)); | 63 std::abs(amount)); |
| 54 } | 64 } |
| OLD | NEW |