diff options
author | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-03 23:06:01 +0000 |
---|---|---|
committer | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-03 23:06:01 +0000 |
commit | dcc7fa421e423ae21cda956f7d9fed2eaff9ee0b (patch) | |
tree | 6c541943ec2bea2ba84e10ee35d2b343b65d348d | |
parent | c44058dd2583d031a76a2187ebfb5292386a5299 (diff) | |
download | chromium_src-dcc7fa421e423ae21cda956f7d9fed2eaff9ee0b.zip chromium_src-dcc7fa421e423ae21cda956f7d9fed2eaff9ee0b.tar.gz chromium_src-dcc7fa421e423ae21cda956f7d9fed2eaff9ee0b.tar.bz2 |
Add a histogram to track Chrome's UpdatePolicy in the field.
BUG=346494
TEST=Run dev chrome and confirm (after 45s) that chrome://histograms shows:
GoogleUpdate.UpdatePolicyIsOverridden => 0 (false)
GoogleUpdate.EffectivePolicy => 1 (AUTOMATIC_UPDATES)
R=asvitkine@chromium.org, grt@chromium.org, isherman@chromium.org
Review URL: https://codereview.chromium.org/178473004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254595 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc | 20 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 19 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.h | 4 | ||||
-rw-r--r-- | chrome/installer/util/install_util.cc | 3 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 22 |
5 files changed, 65 insertions, 3 deletions
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc index cf40846..3fd5bb6 100644 --- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc @@ -28,7 +28,11 @@ #include <gnu/libc-version.h> #include "base/version.h" -#endif +#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) + +#if defined(OS_WIN) +#include "chrome/installer/util/google_update_settings.h" +#endif // defined(OS_WIN) namespace { @@ -63,6 +67,14 @@ void RecordMicroArchitectureStats() { base::SysInfo::NumberOfProcessors()); } +// Called on the blocking pool some time after startup to avoid slowing down +// startup with metrics that aren't trivial to compute. +void RecordStartupMetricsOnBlockingPool() { +#if defined(OS_WIN) + GoogleUpdateSettings::RecordChromeUpdatePolicyHistograms(); +#endif // defined(OS_WIN) +} + void RecordLinuxGlibcVersion() { #if defined(OS_LINUX) && !defined(OS_CHROMEOS) Version version(gnu_get_libc_version()); @@ -136,6 +148,12 @@ void ChromeBrowserMainExtraPartsMetrics::PreBrowserStart() { void ChromeBrowserMainExtraPartsMetrics::PostBrowserStart() { RecordLinuxGlibcVersion(); RecordTouchEventState(); + + const int kStartupMetricsGatheringDelaySeconds = 45; + content::BrowserThread::GetBlockingPool()->PostDelayedTask( + FROM_HERE, + base::Bind(&RecordStartupMetricsOnBlockingPool), + base::TimeDelta::FromSeconds(kStartupMetricsGatheringDelaySeconds)); } namespace chrome { diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 8d4fbd7..500f7e7 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -8,6 +8,9 @@ #include <string> #include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -571,6 +574,22 @@ GoogleUpdateSettings::UpdatePolicy GoogleUpdateSettings::GetAppUpdatePolicy( return update_policy; } +void GoogleUpdateSettings::RecordChromeUpdatePolicyHistograms() { + const bool is_multi_install = InstallUtil::IsMultiInstall( + BrowserDistribution::GetDistribution(), IsSystemInstall()); + const base::string16 app_guid = + BrowserDistribution::GetSpecificDistribution( + is_multi_install ? BrowserDistribution::CHROME_BINARIES : + BrowserDistribution::CHROME_BROWSER)->GetAppGuid(); + + bool is_overridden = false; + const UpdatePolicy update_policy = GetAppUpdatePolicy(app_guid, + &is_overridden); + UMA_HISTOGRAM_BOOLEAN("GoogleUpdate.UpdatePolicyIsOverridden", is_overridden); + UMA_HISTOGRAM_ENUMERATION("GoogleUpdate.EffectivePolicy", update_policy, + UPDATE_POLICIES_COUNT); +} + base::string16 GoogleUpdateSettings::GetUninstallCommandLine( bool system_install) { const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h index 8e99978..dfd948c 100644 --- a/chrome/installer/util/google_update_settings.h +++ b/chrome/installer/util/google_update_settings.h @@ -31,6 +31,7 @@ class GoogleUpdateSettings { AUTOMATIC_UPDATES = 1, MANUAL_UPDATES_ONLY = 2, AUTO_UPDATES_ONLY = 3, + UPDATE_POLICIES_COUNT }; // Defines product data that is tracked/used by Google Update. @@ -227,6 +228,9 @@ class GoogleUpdateSettings { static UpdatePolicy GetAppUpdatePolicy(const std::wstring& app_guid, bool* is_overridden); + // Records UMA stats about Chrome's update policy. + static void RecordChromeUpdatePolicyHistograms(); + // Returns Google Update's uninstall command line, or an empty string if none // is found. static base::string16 GetUninstallCommandLine(bool system_install); diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index 8ff309c..ebdf3b0 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -355,8 +355,7 @@ bool InstallUtil::IsMultiInstall(BrowserDistribution* dist, bool system_install) { DCHECK(dist); ProductState state; - return state.Initialize(system_install, dist->GetType()) && - state.is_multi_install(); + return state.Initialize(system_install, dist) && state.is_multi_install(); } bool CheckIsChromeSxSProcess() { diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 41b5603..5e018fb 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -5836,6 +5836,21 @@ other types of suffix sets. <summary>Events in Google Now component extension.</summary> </histogram> +<histogram name="GoogleUpdate.EffectivePolicy" enum="UpdatePolicy"> + <summary> + The effective update policy for Chrome on Windows. Recorded once per startup + (following a 45 seconds delay). + </summary> +</histogram> + +<histogram name="GoogleUpdate.UpdatePolicyIsOverridden" enum="Boolean"> + <summary> + True if the effective update policy for Chrome on Windows is the result of + an app-specific override; false if it is the default for all apps. Recorded + once per startup (following a 45 seconds delay). + </summary> +</histogram> + <histogram name="GPU.AcceleratedSurfaceRefreshRate" units="hz"> <summary> Refresh rate of the display in Hz. This is recorded every time we present a @@ -34809,6 +34824,13 @@ other types of suffix sets. <int value="2" label="Forced Full"/> </enum> +<enum name="UpdatePolicy" type="int"> + <int value="0" label="UPDATES_DISABLED"/> + <int value="1" label="AUTOMATIC_UPDATES"/> + <int value="2" label="MANUAL_UPDATES_ONLY"/> + <int value="3" label="AUTO_UPDATES_ONLY"/> +</enum> + <enum name="UrlResolutionResult" type="int"> <int value="0" label="Absolute URL"/> <int value="1" label="Resolutions Differ"/> |