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

Unified Diff: chrome/browser/process_singleton_posix.cc

Issue 2399233002: Add histograms to the rendez-vous process (ProcessSingleton). (Closed)
Patch Set: comment on NotifyResult Created 4 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
Index: chrome/browser/process_singleton_posix.cc
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
index 28e961f24b49198c2087003129481a58a559bf69..2128b3f51307dcd7f47ce2cc3adee3b13acc595c 100644
--- a/chrome/browser/process_singleton_posix.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -64,6 +64,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram_macros.h"
#include "base/path_service.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/safe_strerror.h"
@@ -895,12 +896,26 @@ ProcessSingleton::NotifyOtherProcessWithTimeoutOrCreate(
const base::CommandLine& command_line,
int retry_attempts,
const base::TimeDelta& timeout) {
+ const base::TimeTicks begin_ticks = base::TimeTicks::Now();
NotifyResult result = NotifyOtherProcessWithTimeout(
command_line, retry_attempts, timeout, true);
- if (result != PROCESS_NONE)
+ if (result != PROCESS_NONE) {
+ if (result == PROCESS_NOTIFIED) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Chrome.ProcessSingleton.TimeToNotify",
+ base::TimeTicks::Now() - begin_ticks);
+ } else {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Chrome.ProcessSingleton.TimeToFailure",
+ base::TimeTicks::Now() - begin_ticks);
+ }
return result;
- if (Create())
+ }
+
+ if (Create()) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Chrome.ProcessSingleton.TimeToCreate",
+ base::TimeTicks::Now() - begin_ticks);
return PROCESS_NONE;
+ }
+
// If the Create() failed, try again to notify. (It could be that another
// instance was starting at the same time and managed to grab the lock before
// we did.)
@@ -908,6 +923,15 @@ ProcessSingleton::NotifyOtherProcessWithTimeoutOrCreate(
// aren't going to try to take over the lock ourselves.
result = NotifyOtherProcessWithTimeout(
command_line, retry_attempts, timeout, false);
+
+ if (result == PROCESS_NOTIFIED) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Chrome.ProcessSingleton.TimeToNotify",
sky 2016/10/07 19:47:30 Are you sure you don't want to differentiate these
gab 2016/10/07 20:05:46 Well it's still the time it took to achieve a resu
+ base::TimeTicks::Now() - begin_ticks);
+ } else {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Chrome.ProcessSingleton.TimeToFailure",
+ base::TimeTicks::Now() - begin_ticks);
+ }
+
if (result != PROCESS_NONE)
return result;

Powered by Google App Engine
This is Rietveld 408576698