Chromium Code Reviews| 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; |
| + } |
| + |
| + 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); |
| +} |
| + |
|
Evan Stade
2013/02/05 20:06:41
^H
Ilya Sherman
2013/02/06 00:02:25
Done.
|
| + |
| void AutofillMetrics::LogDeveloperEngagementMetric( |
| DeveloperEngagementMetric metric) const { |
| DCHECK(metric < NUM_DEVELOPER_ENGAGEMENT_METRICS); |