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

Side by Side Diff: components/user_prefs/tracked/tracked_preference_helper.cc

Issue 2776853002: Make UMA_HISTOGRAM_ENUMERATION work with scoped enums. (Closed)
Patch Set: rebase 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/user_prefs/tracked/tracked_preference_helper.h" 5 #include "components/user_prefs/tracked/tracked_preference_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "components/user_prefs/tracked/tracked_preference_histogram_names.h" 10 #include "components/user_prefs/tracked/tracked_preference_histogram_names.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 base::HistogramBase::kUmaTargetedHistogramFlag); 104 base::HistogramBase::kUmaTargetedHistogramFlag);
105 histogram->Add(reporting_id_); 105 histogram->Add(reporting_id_);
106 } 106 }
107 107
108 void TrackedPreferenceHelper::ReportAction(ResetAction reset_action) const { 108 void TrackedPreferenceHelper::ReportAction(ResetAction reset_action) const {
109 switch (reset_action) { 109 switch (reset_action) {
110 case DONT_RESET: 110 case DONT_RESET:
111 // No report for DONT_RESET. 111 // No report for DONT_RESET.
112 break; 112 break;
113 case WANTED_RESET: 113 case WANTED_RESET:
114 UMA_HISTOGRAM_ENUMERATION( 114 UMA_HISTOGRAM_EXACT_LINEAR(
115 user_prefs::tracked::kTrackedPrefHistogramWantedReset, reporting_id_, 115 user_prefs::tracked::kTrackedPrefHistogramWantedReset, reporting_id_,
116 reporting_ids_count_); 116 reporting_ids_count_);
117 break; 117 break;
118 case DO_RESET: 118 case DO_RESET:
119 UMA_HISTOGRAM_ENUMERATION(user_prefs::tracked::kTrackedPrefHistogramReset, 119 UMA_HISTOGRAM_EXACT_LINEAR(
120 reporting_id_, reporting_ids_count_); 120 user_prefs::tracked::kTrackedPrefHistogramReset, reporting_id_,
121 reporting_ids_count_);
121 break; 122 break;
122 } 123 }
123 } 124 }
124 125
125 void TrackedPreferenceHelper::ReportSplitPreferenceChangedCount( 126 void TrackedPreferenceHelper::ReportSplitPreferenceChangedCount(
126 size_t count) const { 127 size_t count) const {
127 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro 128 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro
128 // adapted to allow for a dynamically suffixed histogram name. 129 // adapted to allow for a dynamically suffixed histogram name.
129 // Note: The factory creates and owns the histogram. 130 // Note: The factory creates and owns the histogram.
130 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet( 131 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet(
131 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1, 132 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1,
132 100, // Allow counts up to 100. 133 100, // Allow counts up to 100.
133 101, base::HistogramBase::kUmaTargetedHistogramFlag); 134 101, base::HistogramBase::kUmaTargetedHistogramFlag);
134 histogram->Add(count); 135 histogram->Add(count);
135 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698