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

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: Rebase harder Created 7 years, 10 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
« no previous file with comments | « chrome/browser/autofill/autofill_metrics.h ('k') | chrome/browser/autofill/autofill_metrics_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_metrics.cc
diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc
index 6af361cd82f3a8b8dd7dcd90c9613bbc31a9bace..c8bbbd953072c617ed7e493f7b9c1f1e68427654 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,36 @@ void AutofillMetrics::LogAutocheckoutInfoBarMetric(InfoBarMetric metric) const {
NUM_INFO_BAR_METRICS);
}
+void AutofillMetrics::LogRequestAutocompleteUiDuration(
+ const base::TimeDelta& duration,
+ autofill::DialogType dialog_type,
+ DialogDismissalAction dismissal_action) const {
+ std::string prefix;
+ switch (dialog_type) {
+ case autofill::DIALOG_TYPE_AUTOCHECKOUT:
+ prefix = "Autocheckout";
+ break;
+
+ case autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE:
+ prefix = "RequestAutocomplete";
+ break;
+ }
+
+ std::string suffix;
+ switch (dismissal_action) {
+ case DIALOG_ACCEPTED:
+ suffix = "Submit";
+ break;
+
+ case DIALOG_CANCELED:
+ suffix = "Cancel";
+ break;
+ }
+
+ LogUMAHistogramLongTimes(prefix + ".UiDuration", duration);
+ LogUMAHistogramLongTimes(prefix + ".UiDuration." + suffix, duration);
+}
+
void AutofillMetrics::LogDeveloperEngagementMetric(
DeveloperEngagementMetric metric) const {
DCHECK(metric < NUM_DEVELOPER_ENGAGEMENT_METRICS);
« no previous file with comments | « chrome/browser/autofill/autofill_metrics.h ('k') | chrome/browser/autofill/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698