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

Side by Side Diff: chrome/browser/metrics/thread_watcher.cc

Issue 672973002: ThreadWacther - delete the code for Android that collected stats for (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: StartupTimeBomb.Alarm.* histograms obsolete Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/metrics/thread_watcher.h" 5 #include "chrome/browser/metrics/thread_watcher.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 913
914 // StartupWatchDogThread methods and members. 914 // StartupWatchDogThread methods and members.
915 // 915 //
916 // Class for detecting hangs during startup. 916 // Class for detecting hangs during startup.
917 class StartupWatchDogThread : public base::Watchdog { 917 class StartupWatchDogThread : public base::Watchdog {
918 public: 918 public:
919 // Constructor specifies how long the StartupWatchDogThread will wait before 919 // Constructor specifies how long the StartupWatchDogThread will wait before
920 // alarming. 920 // alarming.
921 explicit StartupWatchDogThread(const base::TimeDelta& duration) 921 explicit StartupWatchDogThread(const base::TimeDelta& duration)
922 : base::Watchdog(duration, "Startup watchdog thread", true) { 922 : base::Watchdog(duration, "Startup watchdog thread", true) {
923 #if defined(OS_ANDROID)
924 // TODO(rtenneti): Delete this code, after getting data.
925 start_time_clock_= base::Time::Now();
926 start_time_monotonic_ = base::TimeTicks::Now();
927 start_time_thread_now_ = base::TimeTicks::IsThreadNowSupported()
928 ? base::TimeTicks::ThreadNow() : base::TimeTicks::Now();
929 #endif // OS_ANDROID
930 } 923 }
931 924
932 // Alarm is called if the time expires after an Arm() without someone calling 925 // Alarm is called if the time expires after an Arm() without someone calling
933 // Disarm(). When Alarm goes off, in release mode we get the crash dump 926 // Disarm(). When Alarm goes off, in release mode we get the crash dump
934 // without crashing and in debug mode we break into the debugger. 927 // without crashing and in debug mode we break into the debugger.
935 void Alarm() override { 928 void Alarm() override {
936 #if !defined(NDEBUG) 929 #if !defined(NDEBUG)
937 StartupHang(); 930 StartupHang();
938 return; 931 return;
939 #elif !defined(OS_ANDROID) 932 #elif !defined(OS_ANDROID)
940 WatchDogThread::PostTask(FROM_HERE, base::Bind(&StartupHang)); 933 WatchDogThread::PostTask(FROM_HERE, base::Bind(&StartupHang));
941 return; 934 return;
942 #else // Android release: gather stats to figure out when to crash. 935 #else
943 // TODO(rtenneti): Delete this code, after getting data. 936 // TODO(rtenneti): Enable crashing for Android.
944 UMA_HISTOGRAM_TIMES("StartupTimeBomb.Alarm.TimeDuration",
945 base::Time::Now() - start_time_clock_);
946 UMA_HISTOGRAM_TIMES("StartupTimeBomb.Alarm.TimeTicksDuration",
947 base::TimeTicks::Now() - start_time_monotonic_);
948 if (base::TimeTicks::IsThreadNowSupported()) {
949 UMA_HISTOGRAM_TIMES(
950 "StartupTimeBomb.Alarm.ThreadNowDuration",
951 base::TimeTicks::ThreadNow() - start_time_thread_now_);
952 }
953 return;
954 #endif // OS_ANDROID 937 #endif // OS_ANDROID
955 } 938 }
956 939
957 private: 940 private:
958 #if defined(OS_ANDROID)
959 // TODO(rtenneti): Delete this code, after getting data.
960 base::Time start_time_clock_;
961 base::TimeTicks start_time_monotonic_;
962 base::TimeTicks start_time_thread_now_;
963 #endif // OS_ANDROID
964
965 DISALLOW_COPY_AND_ASSIGN(StartupWatchDogThread); 941 DISALLOW_COPY_AND_ASSIGN(StartupWatchDogThread);
966 }; 942 };
967 943
968 // ShutdownWatchDogThread methods and members. 944 // ShutdownWatchDogThread methods and members.
969 // 945 //
970 // Class for detecting hangs during shutdown. 946 // Class for detecting hangs during shutdown.
971 class ShutdownWatchDogThread : public base::Watchdog { 947 class ShutdownWatchDogThread : public base::Watchdog {
972 public: 948 public:
973 // Constructor specifies how long the ShutdownWatchDogThread will wait before 949 // Constructor specifies how long the ShutdownWatchDogThread will wait before
974 // alarming. 950 // alarming.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 1055
1080 #if defined(OS_WIN) 1056 #if defined(OS_WIN)
1081 // On Windows XP, give twice the time for shutdown. 1057 // On Windows XP, give twice the time for shutdown.
1082 if (base::win::GetVersion() <= base::win::VERSION_XP) 1058 if (base::win::GetVersion() <= base::win::VERSION_XP)
1083 actual_duration *= 2; 1059 actual_duration *= 2;
1084 #endif 1060 #endif
1085 1061
1086 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); 1062 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration);
1087 shutdown_watchdog_->Arm(); 1063 shutdown_watchdog_->Arm();
1088 } 1064 }
OLDNEW
« 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