Index: chrome/browser/metrics/thread_watcher.cc |
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc |
index ab80a8680dae484a3edb303576b5a17b35f8c631..3ec771143ac150b6f31cf89e80eb3e9d3e0bcfcb 100644 |
--- a/chrome/browser/metrics/thread_watcher.cc |
+++ b/chrome/browser/metrics/thread_watcher.cc |
@@ -53,6 +53,13 @@ void NullPointerCrash(int line_number) { |
#endif |
} |
+#if !defined(OS_ANDROID) |
+// TODO(rtenneti): Enabled crashing, after getting data. |
+NOINLINE void StartupCrash() { |
+ NullPointerCrash(__LINE__); |
+} |
+#endif // OS_ANDROID |
+ |
NOINLINE void ShutdownCrash() { |
NullPointerCrash(__LINE__); |
} |
@@ -882,20 +889,48 @@ class StartupWatchDogThread : public base::Watchdog { |
// alarming. |
explicit StartupWatchDogThread(const base::TimeDelta& duration) |
: base::Watchdog(duration, "Startup watchdog thread", true) { |
+#if defined(OS_ANDROID) |
+ // TODO(rtenneti): Delete this code, after getting data. |
+ start_time_clock_= base::Time::Now(); |
+ start_time_monotonic_ = base::TimeTicks::Now(); |
+ start_time_thread_now_ = base::TimeTicks::IsThreadNowSupported() |
+ ? base::TimeTicks::ThreadNow() : base::TimeTicks::Now(); |
+#endif // OS_ANDROID |
} |
// Alarm is called if the time expires after an Arm() without someone calling |
// Disarm(). When Alarm goes off, in release mode we get the crash dump |
// without crashing and in debug mode we break into the debugger. |
virtual void Alarm() OVERRIDE { |
+#if defined(OS_ANDROID) |
+ // TODO(rtenneti): Delete this code, after getting data. |
+ // On Android, we don't crash, but we will collect stats. |
+ UMA_HISTOGRAM_TIMES("StartupTimebomm.Alarm.TimeDuration", |
+ base::Time::Now() - start_time_clock_); |
+ UMA_HISTOGRAM_TIMES("StartupTimebomm.Alarm.TimeTicksDuration", |
+ base::TimeTicks::Now() - start_time_monotonic_); |
+ if (base::TimeTicks::IsThreadNowSupported()) { |
+ UMA_HISTOGRAM_TIMES( |
+ "StartupTimebomm.Alarm.ThreadNowDuration", |
+ base::TimeTicks::ThreadNow() - start_time_thread_now_); |
+ } |
+#else |
#ifndef NDEBUG |
jar (doing other things)
2014/05/03 02:00:21
nit: I like less ifdef protected, and especially n
ramant (doing other things)
2014/05/03 04:11:36
Done.
|
- DCHECK(false); |
+ StartupCrash(); |
#else |
- WatchDogThread::PostTask(FROM_HERE, |
- base::Bind(&base::debug::DumpWithoutCrashing)); |
jar (doing other things)
2014/05/03 02:00:21
Is this a deliberate change to crashing? Did you
ramant (doing other things)
2014/05/03 04:11:36
In DEBUG builds we used to crash and we do the sam
|
-#endif |
+ WatchDogThread::PostTask(FROM_HERE, base::Bind(&StartupCrash)); |
+#endif // NDEBUG |
+#endif // OS_ANDROID |
} |
+ private: |
+#if defined(OS_ANDROID) |
+ // TODO(rtenneti): Delete this code, after getting data. |
+ base::Time start_time_clock_; |
+ base::TimeTicks start_time_monotonic_; |
+ base::TimeTicks start_time_thread_now_; |
+#endif // OS_ANDROID |
+ |
DISALLOW_COPY_AND_ASSIGN(StartupWatchDogThread); |
}; |
@@ -916,6 +951,7 @@ class ShutdownWatchDogThread : public base::Watchdog { |
ShutdownCrash(); |
} |
+ private: |
DISALLOW_COPY_AND_ASSIGN(ShutdownWatchDogThread); |
}; |
} // namespace |