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

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

Issue 901903005: Add SRT log upload result metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: facepalm Created 5 years, 10 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 722946a9f3750405633bd37ab1e6fde21ad9c109..5c0b9bf496b353f70eed17013b1c33d2ce018341 100644
--- a/chrome/browser/component_updater/sw_reporter_installer_win.cc
+++ b/chrome/browser/component_updater/sw_reporter_installer_win.cc
@@ -25,6 +25,7 @@
#include "base/prefs/pref_service.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
+#include "base/strings/string_tokenizer.h"
#include "base/task_runner_util.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
@@ -87,10 +88,11 @@ const base::FilePath::CharType kSwReporterExeName[] =
const wchar_t kSoftwareRemovalToolRegistryKey[] =
L"Software\\Google\\Software Removal Tool";
const wchar_t kCleanerSuffixRegistryKey[] = L"Cleaner";
+const wchar_t kEndTimeRegistryValueName[] = L"EndTime";
const wchar_t kExitCodeRegistryValueName[] = L"ExitCode";
-const wchar_t kVersionRegistryValueName[] = L"Version";
const wchar_t kStartTimeRegistryValueName[] = L"StartTime";
-const wchar_t kEndTimeRegistryValueName[] = L"EndTime";
+const wchar_t kUploadResultsValueName[] = L"UploadResults";
+const wchar_t kVersionRegistryValueName[] = L"Version";
// Field trial strings.
const char kSRTPromptTrialName[] = "SRTPromptFieldTrial";
@@ -134,6 +136,37 @@ void ReportVersionWithUma(const base::Version& version) {
UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.MajorVersion", major_version);
}
+void ReportUploadsWithUma(const base::string16& upload_results) {
+ base::WStringTokenizer tokenizer(upload_results, L";");
+ int failure_count = 0;
+ int success_count = 0;
+ int longest_failure_run = 0;
+ int current_failure_run = 0;
+ bool last_result = false;
+ while (tokenizer.GetNext()) {
+ if (tokenizer.token() == L"0") {
+ ++failure_count;
+ ++current_failure_run;
+ last_result = false;
+ } else {
+ ++success_count;
+ current_failure_run = 0;
+ last_result = true;
+ }
+
+ if (current_failure_run > longest_failure_run)
+ longest_failure_run = current_failure_run;
+ }
+
+ UMA_HISTOGRAM_COUNTS_100("SoftwareReporter.UploadFailureCount",
+ failure_count);
+ UMA_HISTOGRAM_COUNTS_100("SoftwareReporter.UploadSuccessCount",
+ success_count);
+ UMA_HISTOGRAM_COUNTS_100("SoftwareReporter.UploadLongestFailureRun",
+ longest_failure_run);
+ UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.LastUploadResult", last_result);
+}
+
// This function is called on the UI thread to report the SwReporter exit code
// and then clear it from the registry as well as clear the execution state
// from the local state. This could be called from an interruptible worker
@@ -416,6 +449,12 @@ void RegisterSwReporterComponent(ComponentUpdateService* cus,
"SoftwareReporter.Cleaner.HasRebooted",
static_cast<uint64>(elapsed.InMilliseconds()) > ::GetTickCount());
}
+
+ if (cleaner_key.HasValue(kUploadResultsValueName)) {
+ base::string16 upload_results;
+ cleaner_key.ReadValue(kUploadResultsValueName, &upload_results);
+ ReportUploadsWithUma(upload_results);
+ }
}
// Install the component.
« 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