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

Unified Diff: chrome/browser/autofill/autofill_metrics.cc

Issue 12091086: [Autofill] Add UMA timing metrics for requestAutocomplete dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the "autocomplete" prefix Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_metrics.cc
diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc
index 94f3cff695f4904f9ef45f506a6b87063ed14d3a..bb526cdca8028267f8018b7b62b60834e6eba793 100644
--- a/chrome/browser/autofill/autofill_metrics.cc
+++ b/chrome/browser/autofill/autofill_metrics.cc
@@ -160,17 +160,30 @@ int GetFieldTypeGroupMetric(const AutofillFieldType field_type,
void LogUMAHistogramEnumeration(const std::string& name,
int sample,
int boundary_value) {
- // We can't use the UMA_HISTOGRAM_ENUMERATION macro here because the histogram
- // name can vary over the duration of the program.
- // Note that this leaks memory; that is expected behavior.
- base::HistogramBase* counter =
+ // Note: This leaks memory, which is expected behavior.
+ base::HistogramBase* histogram =
base::LinearHistogram::FactoryGet(
name,
1,
boundary_value,
boundary_value + 1,
base::HistogramBase::kUmaTargetedHistogramFlag);
- counter->Add(sample);
+ histogram->Add(sample);
+}
+
+// A version of the UMA_HISTOGRAM_LONG_TIMES macro that allows the |name|
+// to vary over the program's runtime.
+void LogUMAHistogramLongTimes(const std::string& name,
+ const base::TimeDelta& duration) {
+ // Note: This leaks memory, which is expected behavior.
+ base::HistogramBase* histogram =
+ base::Histogram::FactoryTimeGet(
+ name,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromHours(1),
+ 50,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+ histogram->AddTime(duration);
}
// Logs a type quality metric. The primary histogram name is constructed based
@@ -268,6 +281,37 @@ void AutofillMetrics::LogAutocheckoutInfoBarMetric(InfoBarMetric metric) const {
NUM_INFO_BAR_METRICS);
}
+void AutofillMetrics::LogRequestAutocompleteUiDuration(
+ const base::TimeDelta& duration,
+ autofill::DialogRequester requester,
+ DialogDismissalAction dismissal_action) const {
+ std::string prefix;
+ switch (requester) {
+ case autofill::DIALOG_REQUESTER_AUTOCHECKOUT:
+ prefix = "Autocheckout";
+ break;
+
+ case autofill::DIALOG_REQUESTER_REQUEST_AUTOCOMPLETE:
+ prefix = "RequestAutocomplete";
+ break;
benquan 2013/02/02 02:02:31 Nit: handle default ?
Ilya Sherman 2013/02/02 02:09:12 The default case is intentionally omitted, so that
+ }
+
+ std::string suffix;
+ switch (dismissal_action) {
+ case DIALOG_ACCEPTED:
+ suffix = "Submit";
+ break;
+
+ case DIALOG_CANCELED:
+ suffix = "Cancel";
+ break;
benquan 2013/02/02 02:02:31 Ditto
Ilya Sherman 2013/02/02 02:09:12 Ditto.
+ }
+
+ LogUMAHistogramLongTimes(prefix + ".UiDuration", duration);
benquan 2013/02/02 02:02:31 Do we need to log both?
Ilya Sherman 2013/02/02 02:09:12 Per the bug, we want both, yes. It's often conven
+ LogUMAHistogramLongTimes(prefix + ".UiDuration." + suffix, duration);
+}
+
+
void AutofillMetrics::LogDeveloperEngagementMetric(
DeveloperEngagementMetric metric) const {
DCHECK(metric < NUM_DEVELOPER_ENGAGEMENT_METRICS);

Powered by Google App Engine
This is Rietveld 408576698