diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 01:46:07 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 01:46:07 +0000 |
commit | 6694943c4ba9dd9b79973f7eea2f32d004529c7c (patch) | |
tree | 61d9c3430b958b43a7ab59f9a76047800a4c45a3 /chrome/browser/chromeos/external_metrics.cc | |
parent | 7ff31a9604eab29d69f466fa1e50aa0437d0c5a5 (diff) | |
download | chromium_src-6694943c4ba9dd9b79973f7eea2f32d004529c7c.zip chromium_src-6694943c4ba9dd9b79973f7eea2f32d004529c7c.tar.gz chromium_src-6694943c4ba9dd9b79973f7eea2f32d004529c7c.tar.bz2 |
chromeos: Add some network metrics to the external metrics transport.
Also test all metrics names in the unit test.
(change is by semenzato@chromium.org and was already
reviewed by rvargas at http://codereview.chromium.org/489008)
TBR=semenzato
Review URL: http://codereview.chromium.org/500041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/external_metrics.cc')
-rw-r--r-- | chrome/browser/chromeos/external_metrics.cc | 88 |
1 files changed, 84 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc index b97dbb1..3eb8936 100644 --- a/chrome/browser/chromeos/external_metrics.cc +++ b/chrome/browser/chromeos/external_metrics.cc @@ -21,6 +21,18 @@ #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" +// Steps to add a stat: +// +// 1. Enter the stat in the function_table_ (specify histogram or action). +// Note that the macros concatenate strings. Also note that stat names must be +// in alphabetical order (there is an init-time test but only for debug +// builds). +// +// 2. Enter a helper function that calls either one of the UMA_HISTOGRAM +// macros, or UserMetrics::RecordAction. +// +// 3. Enjoy the recompilation. + namespace chromeos { // The interval between external metrics collections, in milliseconds. @@ -49,7 +61,7 @@ static void RecordBootTime(const char* info) { base::TimeDelta::FromMilliseconds(time), base::TimeDelta::FromSeconds(0), base::TimeDelta::FromSeconds(60), - 100); + 50); } static void RecordUpTime(const char* info) { @@ -58,6 +70,66 @@ static void RecordUpTime(const char* info) { base::TimeDelta::FromSeconds(time)); } +static void RecordConnmanIdle(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_LONG_TIMES("ChromeOS.Net.Connman.Idle", + base::TimeDelta::FromMilliseconds(time)); +} + +static void RecordConnmanOffline(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_LONG_TIMES("ChromeOS.Net.Connman.Offline", + base::TimeDelta::FromMilliseconds(time)); +} + +static void RecordConnmanOnline(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_LONG_TIMES("ChromeOS.Net.Connman.Online", + base::TimeDelta::FromMilliseconds(time)); +} + +static void RecordConnmanReady(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_LONG_TIMES("ChromeOS.Net.Connman.Ready", + base::TimeDelta::FromMilliseconds(time)); +} + +static void RecordConnmanAssociation(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_CUSTOM_TIMES("ChromeOS.Net.Connman.Association", + base::TimeDelta::FromMilliseconds(time), + base::TimeDelta::FromSeconds(0), + base::TimeDelta::FromSeconds(120), + 50); +} + +static void RecordConnmanConfiguration(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_CUSTOM_TIMES("ChromeOS.Net.Connman.Configuration", + base::TimeDelta::FromMilliseconds(time), + base::TimeDelta::FromSeconds(0), + base::TimeDelta::FromSeconds(120), + 50); +} + +static void RecordConnmanDisconnect(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_CUSTOM_TIMES("ChromeOS.Net.Connman.Disconnect", + base::TimeDelta::FromMilliseconds(time), + base::TimeDelta::FromSeconds(0), + base::TimeDelta::FromSeconds(30), + 50); +} + +static void RecordConnmanFailure(const char* info) { + int64 time = atol(info); + UMA_HISTOGRAM_CUSTOM_TIMES("ChromeOS.Net.Connman.Failure", + base::TimeDelta::FromMilliseconds(time), + base::TimeDelta::FromSeconds(0), + base::TimeDelta::FromSeconds(30), + 50); +} + void ExternalMetrics::Start(Profile* profile) { DCHECK(external_metrics_profile == NULL); external_metrics_profile = profile; @@ -83,9 +155,17 @@ void ExternalMetrics::RecordActionWrapper(RecordFunctionType f) { ExternalMetrics::RecordFunctionTableEntry ExternalMetrics::function_table_[] = { // These entries MUST be in alphabetical order. - RF_ENTRY(BootTime, EVENT_TYPE_HISTOGRAM), - RF_ENTRY(TabOverviewExitMouse, EVENT_TYPE_ACTION), - RF_ENTRY(TabOverviewKeystroke, EVENT_TYPE_ACTION), + RF_ENTRY(BootTime, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanAssociation, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanConfiguration, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanDisconnect, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanFailure, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanIdle, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanOffline, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanOnline, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(ConnmanReady, EVENT_TYPE_HISTOGRAM), + RF_ENTRY(TabOverviewExitMouse, EVENT_TYPE_ACTION), + RF_ENTRY(TabOverviewKeystroke, EVENT_TYPE_ACTION), RF_ENTRY(UpTime, EVENT_TYPE_HISTOGRAM), }; |