diff options
author | rouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 23:54:50 +0000 |
---|---|---|
committer | rouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-14 23:54:50 +0000 |
commit | 4015e4d1711d2c0d48ed2691c0f2bae53d22e045 (patch) | |
tree | bf6e44bbf1b266235af5f0dd932003ee60c55b3a /chrome/browser/intents | |
parent | 311af259f0ae9b833c0844581aa7a44646160444 (diff) | |
download | chromium_src-4015e4d1711d2c0d48ed2691c0f2bae53d22e045.zip chromium_src-4015e4d1711d2c0d48ed2691c0f2bae53d22e045.tar.gz chromium_src-4015e4d1711d2c0d48ed2691c0f2bae53d22e045.tar.bz2 |
UMA reporting for duration of time spent in service
BUG=147338
R=smckay@chromium.org
Adding Greg, since I don't have commit privs.
Review URL: https://chromiumcodereview.appspot.com/10919171
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/intents')
-rw-r--r-- | chrome/browser/intents/web_intents_reporting.cc | 39 | ||||
-rw-r--r-- | chrome/browser/intents/web_intents_reporting.h | 10 |
2 files changed, 49 insertions, 0 deletions
diff --git a/chrome/browser/intents/web_intents_reporting.cc b/chrome/browser/intents/web_intents_reporting.cc index 6c07de5..0a63ba7 100644 --- a/chrome/browser/intents/web_intents_reporting.cc +++ b/chrome/browser/intents/web_intents_reporting.cc @@ -30,6 +30,18 @@ const TypeMapping kTypeMap[] = { { "video", TYPE_ID_VIDEO }, }; +// The number of buckets for the histogram of the duration of time spent in a +// service. +const int kServiceActiveTimeNumBuckets = 10; + +// The lower bound on the tracked duration of time spent in a service. +// This bound is in seconds. +const int kServiceActiveDurationMinSeconds = 1; + +// The upper bound on the tracked duration of time spent in a service. +// This bound is in seconds. +const int kServiceActiveDurationMaxSeconds = 3600; + // Returns the ActionMapping for |action| if one exists, or NULL. TypeId ToTypeId(const string16& type) { const std::string iana_type = net::GetIANAMediaType(UTF16ToASCII(type)); @@ -108,4 +120,31 @@ void RecordCWSExtensionInstalled(const UMABucket bucket) { bucket, kMaxActionTypeHistogramValue); } +void RecordServiceActiveDuration( + webkit_glue::WebIntentReplyType reply_type, + const base::TimeDelta& duration) { + switch (reply_type) { + case webkit_glue::WEB_INTENT_REPLY_SUCCESS: + UMA_HISTOGRAM_CUSTOM_TIMES("WebIntents.Service.ActiveDuration.Success", + duration, + base::TimeDelta::FromSeconds(kServiceActiveDurationMinSeconds), + base::TimeDelta::FromSeconds(kServiceActiveDurationMaxSeconds), + kServiceActiveTimeNumBuckets); + break; + case webkit_glue::WEB_INTENT_REPLY_INVALID: + case webkit_glue::WEB_INTENT_REPLY_FAILURE: + case webkit_glue::WEB_INTENT_PICKER_CANCELLED: + case webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED: + UMA_HISTOGRAM_CUSTOM_TIMES("WebIntents.Service.ActiveDuration.Failure", + duration, + base::TimeDelta::FromSeconds(kServiceActiveDurationMinSeconds), + base::TimeDelta::FromSeconds(kServiceActiveDurationMaxSeconds), + kServiceActiveTimeNumBuckets); + break; + default: + NOTREACHED(); + break; + } +} + } // namespace web_intents diff --git a/chrome/browser/intents/web_intents_reporting.h b/chrome/browser/intents/web_intents_reporting.h index 1d41b7b..c237f15 100644 --- a/chrome/browser/intents/web_intents_reporting.h +++ b/chrome/browser/intents/web_intents_reporting.h @@ -7,6 +7,11 @@ #include "base/string16.h" #include "chrome/browser/intents/web_intents_util.h" +#include "webkit/glue/web_intent_reply_data.h" + +namespace base { +class TimeDelta; +} namespace webkit_glue { struct WebIntentData; @@ -125,6 +130,11 @@ void RecordIntentDispatched(const UMABucket bucket); void RecordPickerShow(const UMABucket bucket, size_t installed); void RecordPickerCancel(const UMABucket bucket); void RecordServiceInvoke(const UMABucket bucket); +// Records the |duration| of time spent in the service. Uses |reply_type| to +// distinguish between failed and successful service usage. +void RecordServiceActiveDuration( + webkit_glue::WebIntentReplyType reply_type, + const base::TimeDelta& duration); void RecordChooseAnotherService(const UMABucket bucket); void RecordCWSExtensionInstalled(const UMABucket bucket); } // namespace web_intents |