Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / metrics / metrics_service_base.cc
blob5f4edc25e44f8f82901d7ea88ee33de5104ab026
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
3 // found in the LICENSE file.
5 #include "chrome/common/metrics/metrics_service_base.h"
7 #include <cstdlib>
9 #include "chrome/common/metrics/metrics_log_base.h"
11 using base::Histogram;
13 MetricsServiceBase::MetricsServiceBase()
14 : histogram_snapshot_manager_(this) {
17 MetricsServiceBase::~MetricsServiceBase() {
20 // static
21 const char MetricsServiceBase::kServerUrl[] =
22 "https://clients4.google.com/uma/v2";
24 // static
25 const char MetricsServiceBase::kMimeType[] = "application/vnd.chrome.uma";
27 void MetricsServiceBase::RecordCurrentHistograms() {
28 DCHECK(log_manager_.current_log());
29 histogram_snapshot_manager_.PrepareDeltas(base::Histogram::kNoFlags, true);
32 void MetricsServiceBase::RecordDelta(
33 const base::HistogramBase& histogram,
34 const base::HistogramSamples& snapshot) {
35 log_manager_.current_log()->RecordHistogramDelta(histogram.histogram_name(),
36 snapshot);
39 void MetricsServiceBase::InconsistencyDetected(
40 base::HistogramBase::Inconsistency problem) {
41 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowser",
42 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE);
45 void MetricsServiceBase::UniqueInconsistencyDetected(
46 base::HistogramBase::Inconsistency problem) {
47 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowserUnique",
48 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE);
51 void MetricsServiceBase::InconsistencyDetectedInLoggedCount(int amount) {
52 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotBrowser",
53 std::abs(amount));