Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Unified Diff: chrome/browser/component_updater/sw_reporter_installer_win.cc

Issue 660563004: Added UMA statistics for Chrome Cleaner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed histograms. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/sw_reporter_installer_win.cc
diff --git a/chrome/browser/component_updater/sw_reporter_installer_win.cc b/chrome/browser/component_updater/sw_reporter_installer_win.cc
index f7beb46f81dfaacf0fd5411bf88a86ed98f615f1..a1e8837b06765aa8b6aca7ab41f415e760e6a80c 100644
--- a/chrome/browser/component_updater/sw_reporter_installer_win.cc
+++ b/chrome/browser/component_updater/sw_reporter_installer_win.cc
@@ -82,7 +82,11 @@ const base::FilePath::CharType kSwReporterExeName[] =
// Where to fetch the reporter exit code in the registry.
const wchar_t kSoftwareRemovalToolRegistryKey[] =
L"Software\\Google\\Software Removal Tool";
+const wchar_t kCleanerSuffixRegistryKey[] = L"Cleaner";
const wchar_t kExitCodeRegistryValueName[] = L"ExitCode";
+const wchar_t kVersionRegistryValueName[] = L"Version";
+const wchar_t kStartTimeRegistryValueName[] = L"StartTime";
+const wchar_t kEndTimeRegistryValueName[] = L"EndTime";
// Field trial strings.
const char kSRTPromptTrialName[] = "SRTPromptFieldTrial";
@@ -329,6 +333,49 @@ void RegisterSwReporterComponent(ComponentUpdateService* cus,
return;
}
+ // Check if we have information from Cleaner and record UMA statistics.
+ base::string16 cleaner_key_name(kSoftwareRemovalToolRegistryKey);
+ cleaner_key_name.append(1, L'\\').append(kCleanerSuffixRegistryKey);
+ base::win::RegKey cleaner_key(
+ HKEY_CURRENT_USER, cleaner_key_name.c_str(), KEY_ALL_ACCESS);
+ // Cleaner is assumed to have run if we have a start time.
+ if (cleaner_key.Valid() &&
+ cleaner_key.HasValue(kStartTimeRegistryValueName)) {
+ // Get version number.
+ if (cleaner_key.HasValue(kVersionRegistryValueName)) {
+ DWORD version;
+ cleaner_key.ReadValueDW(kVersionRegistryValueName, &version);
+ UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.Cleaner.Version", version);
+ cleaner_key.DeleteValue(kVersionRegistryValueName);
+ }
+ // Get start & end time.
+ if (cleaner_key.HasValue(kEndTimeRegistryValueName)) {
Alexei Svitkine (slow) 2014/10/29 21:47:51 Could it happen that the kEndTime was from a previ
Georges Khalil 2014/10/30 13:57:58 The registry is cleared every time the cleaner sta
+ int64 start_time_value;
+ cleaner_key.ReadInt64(kStartTimeRegistryValueName, &start_time_value);
+ int64 end_time_value;
+ cleaner_key.ReadInt64(kEndTimeRegistryValueName, &end_time_value);
+ cleaner_key.DeleteValue(kEndTimeRegistryValueName);
+ base::TimeDelta run_time(base::Time::FromInternalValue(end_time_value) -
+ base::Time::FromInternalValue(start_time_value));
+ UMA_HISTOGRAM_LONG_TIMES("SoftwareReporter.Cleaner.RunTime", run_time);
+ } else {
+ // If we don't have an end time, we can assume the cleaner crashed and we
+ // represent this using an infinite delta.
+ UMA_HISTOGRAM_LONG_TIMES("SoftwareReporter.Cleaner.RunTime",
+ base::TimeDelta::Max());
Alexei Svitkine (slow) 2014/10/29 21:47:51 Are you sure you want to do this? This will make
Georges Khalil 2014/10/30 13:57:57 Added a histogram for whether the cleaner has comp
+ }
+ // Get exit code.
+ if (cleaner_key.HasValue(kExitCodeRegistryValueName)) {
+ DWORD exit_code;
+ cleaner_key.ReadValueDW(kExitCodeRegistryValueName, &exit_code);
+ UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.Cleaner.ExitCode",
+ exit_code);
+ cleaner_key.DeleteValue(kExitCodeRegistryValueName);
+ }
+ cleaner_key.DeleteValue(kStartTimeRegistryValueName);
+ }
+
+
Alexei Svitkine (slow) 2014/10/29 21:47:51 Nit: Remove blank line.
Georges Khalil 2014/10/30 13:57:57 Done.
// Install the component.
scoped_ptr<ComponentInstallerTraits> traits(
new SwReporterInstallerTraits(prefs));
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698