diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-12 16:52:21 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-12 16:52:21 +0000 |
commit | 9274524c812a7935e16105a8f6bba6ed01e5ed63 (patch) | |
tree | 0c07fc347321f5f13f9c37bdc3adc1bb43675b1c | |
parent | f88ba61a8133ced5acb6d1f5a8df69d149cc42fd (diff) | |
download | chromium_src-9274524c812a7935e16105a8f6bba6ed01e5ed63.zip chromium_src-9274524c812a7935e16105a8f6bba6ed01e5ed63.tar.gz chromium_src-9274524c812a7935e16105a8f6bba6ed01e5ed63.tar.bz2 |
Histogram count of number of command line arguments
This should help us evaluate which users are manually switching on
non-standard options, which in turn may impact stability.
r=huanr
Review URL: http://codereview.chromium.org/126024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18281 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/command_line.h | 3 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 21 |
2 files changed, 23 insertions, 1 deletions
diff --git a/base/command_line.h b/base/command_line.h index c895b81..903e9b5 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -75,6 +75,9 @@ class CommandLine { // the empty string. std::wstring GetSwitchValue(const std::wstring& switch_string) const; + // Get the number of switches in this process. + size_t GetSwitchCount() const { return switches_.size(); } + // Get the remaining arguments to the command. // WARNING: this is incorrect on POSIX; we must do string conversions. std::vector<std::wstring> GetLooseValues() const; diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index c822500..fa4d1db 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -181,6 +181,7 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/common/child_process_info.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/histogram_synchronizer.h" #include "chrome/common/libxml_utils.h" #include "chrome/common/notification_service.h" @@ -710,6 +711,24 @@ void MetricsService::InitializeMetricsState() { } } + // Get stats on use of command line. + const CommandLine* command_line(CommandLine::ForCurrentProcess()); + size_t common_commands = 0; + if (command_line->HasSwitch(switches::kUserDataDir)) { + ++common_commands; + UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineDatDirCount", 1); + } + + if (command_line->HasSwitch(switches::kApp)) { + ++common_commands; + UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineAppModeCount", 1); + } + + UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineFlagCount", + command_line->GetSwitchCount()); + UMA_HISTOGRAM_COUNTS_100("Chrome.CommandLineUncommonFlagCount", + command_line->GetSwitchCount() - common_commands); + // Kick off the process of saving the state (so the uptime numbers keep // getting updated) every n minutes. ScheduleNextStateSave(); @@ -1558,7 +1577,7 @@ void MetricsService::LogWindowChange(NotificationType type, } else { controller_id = window_map_[window_or_tab]; } - DCHECK(controller_id != -1); + DCHECK_NE(controller_id, -1); switch (type.value) { case NotificationType::TAB_PARENTED: |