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

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: Check if we have information from Cleaner and record UMA statistics. 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') | no next file with comments »
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 c862b462cbfbebf2ebc140042095965fcb1eade2..05f77de771ec99e1326aacb7cd6d206f8cd6be97 100644
--- a/chrome/browser/component_updater/sw_reporter_installer_win.cc
+++ b/chrome/browser/component_updater/sw_reporter_installer_win.cc
@@ -23,6 +23,7 @@
#include "base/prefs/pref_service.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
+#include "base/strings/stringprintf.h"
#include "base/task_runner_util.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
@@ -82,7 +83,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"%ls\\Cleaner";
MAD 2014/10/20 01:38:33 Since the other string is simply at the beginning,
Georges Khalil 2014/10/24 12:37:58 Done.
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";
@@ -330,6 +335,47 @@ void RegisterSwReporterComponent(ComponentUpdateService* cus,
return;
}
+ // Check if we have information from Cleaner and record UMA statistics.
+ base::string16 cleaner_key_name = base::StringPrintf(
+ kCleanerSuffixRegistryKey, kSoftwareRemovalToolRegistryKey);
+ 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)) {
+ int64 start_time_value;
+ cleaner_key.ReadInt64(kStartTimeRegistryValueName, &start_time_value);
MAD 2014/10/20 01:38:33 Since we only use the start_time when we have a va
Georges Khalil 2014/10/24 12:37:58 Done.
+ base::Time start_time = base::Time::FromInternalValue(start_time_value);
MAD 2014/10/20 01:38:33 We usually prefer using the constructor instead of
Georges Khalil 2014/10/24 12:37:58 Done.
+ cleaner_key.DeleteValue(kStartTimeRegistryValueName);
MAD 2014/10/20 01:38:33 Then this would need to move lower below of course
Georges Khalil 2014/10/24 12:37:58 Done.
+ // Get version number.
+ if (cleaner_key.HasValue(kVersionRegistryValueName)) {
+ DWORD version;
+ cleaner_key.ReadValueDW(kVersionRegistryValueName, &version);
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Cleaner.Version", version);
+ cleaner_key.DeleteValue(kVersionRegistryValueName);
+ }
+ // Get end time.
+ if (cleaner_key.HasValue(kEndTimeRegistryValueName)) {
+ int64 end_time_value;
+ cleaner_key.ReadInt64(kEndTimeRegistryValueName, &end_time_value);
+ base::Time end_time = base::Time::FromInternalValue(end_time_value);
MAD 2014/10/20 01:38:33 Use constructor instead, or use the return value d
Georges Khalil 2014/10/24 12:37:58 Done.
+ cleaner_key.DeleteValue(kEndTimeRegistryValueName);
+ base::TimeDelta run_time = end_time - start_time;
+ UMA_HISTOGRAM_LONG_TIMES("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("Cleaner.RunTime", base::TimeDelta::Max());
+ }
+ // Get exit code.
+ if (cleaner_key.HasValue(kExitCodeRegistryValueName)) {
+ DWORD exit_code;
+ cleaner_key.ReadValueDW(kExitCodeRegistryValueName, &exit_code);
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Cleaner.ExitCode", exit_code);
+ cleaner_key.DeleteValue(kExitCodeRegistryValueName);
+ }
+ }
+
// Install the component.
scoped_ptr<ComponentInstallerTraits> traits(
new SwReporterInstallerTraits(prefs));
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698