diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 05:35:38 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 05:35:38 +0000 |
commit | 364213680e41130acd4d4f9a5331c3a43c1b2ce5 (patch) | |
tree | 3d77eec3cfa80cb3a69c425ec8678ed54905af69 /chrome/browser/metrics | |
parent | cbae46d1cceeee0076798e1c8a2853dc35781df0 (diff) | |
download | chromium_src-364213680e41130acd4d4f9a5331c3a43c1b2ce5.zip chromium_src-364213680e41130acd4d4f9a5331c3a43c1b2ce5.tar.gz chromium_src-364213680e41130acd4d4f9a5331c3a43c1b2ce5.tar.bz2 |
Revert 86976 - Changed the ping count from 3 to 6, unresponsive count from 3 to 6.
Changed how often we send a ping from 2 secs to 1 sec. Changed check
for unresponsiveness time from 4 secs to 2 secs.
From jar: this change is to make it harder for scheduler to
a) grant time slices coursely; and
b) favor the watchdog and disfavor the IO thread.
BUG=84145
TEST=thread watcher unit tests
R=jar
Review URL: http://codereview.chromium.org/6962033
TBR=rtenneti@chromium.org
Review URL: http://codereview.chromium.org/6962036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86979 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r-- | chrome/browser/metrics/thread_watcher.cc | 18 | ||||
-rw-r--r-- | chrome/browser/metrics/thread_watcher.h | 5 | ||||
-rw-r--r-- | chrome/browser/metrics/thread_watcher_unittest.cc | 4 |
3 files changed, 12 insertions, 15 deletions
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc index 2b2ab3b..401c62a 100644 --- a/chrome/browser/metrics/thread_watcher.cc +++ b/chrome/browser/metrics/thread_watcher.cc @@ -13,10 +13,10 @@ #endif // static -const int ThreadWatcher::kPingCount = 6; +const int ThreadWatcher::kPingCount = 3; // static -const int ThreadWatcher::kUnresponsiveCount = 6; +const int ThreadWatcher::kUnresponsiveCount = 3; // ThreadWatcher methods and members. ThreadWatcher::ThreadWatcher(const BrowserThread::ID& thread_id, @@ -79,7 +79,6 @@ void ThreadWatcher::ActivateThreadWatching() { if (active_) return; active_ = true; ping_count_ = kPingCount; - ResetHangCounters(); MessageLoop::current()->PostTask( FROM_HERE, method_factory_.NewRunnableMethod(&ThreadWatcher::PostPingMessage)); @@ -100,7 +99,6 @@ void ThreadWatcher::WakeUp() { if (ping_count_ <= 0) { ping_count_ = kPingCount; - ResetHangCounters(); PostPingMessage(); } else { ping_count_ = kPingCount; @@ -180,7 +178,7 @@ bool ThreadWatcher::OnCheckResponsiveness(uint64 ping_sequence_number) { if (ping_sequence_number_ != ping_sequence_number) { // Reset unresponsive_count_ to zero because we got a response from the // watched thread. - ResetHangCounters(); + GotGoodResponse(); return true; } // Record that we got no response from watched thread. @@ -235,7 +233,7 @@ void ThreadWatcher::OnPingMessage(const BrowserThread::ID& thread_id, WatchDogThread::PostTask(FROM_HERE, callback_task); } -void ThreadWatcher::ResetHangCounters() { +void ThreadWatcher::GotGoodResponse() { DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); unresponsive_count_ = 0; hung_processing_complete_ = false; @@ -245,7 +243,7 @@ void ThreadWatcher::GotNoResponse() { DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); // Record how other threads are responding when we don't get a response for - // ping message atleast kUnresponsiveCount times. + // ping message atleast kUnresponsiveCount (three) times. if (++unresponsive_count_ < kUnresponsiveCount) return; @@ -284,9 +282,9 @@ void ThreadWatcher::GotNoResponse() { // static ThreadWatcherList* ThreadWatcherList::global_ = NULL; // static -const int ThreadWatcherList::kSleepSeconds = 1; +const int ThreadWatcherList::kSleepSeconds = 2; // static -const int ThreadWatcherList::kUnresponsiveSeconds = 2; +const int ThreadWatcherList::kUnresponsiveSeconds = 4; ThreadWatcherList::ThreadWatcherList() : last_wakeup_time_(base::TimeTicks::Now()) { @@ -422,7 +420,7 @@ void ThreadWatcherList::Observe(NotificationType type, base::TimeTicks now = base::TimeTicks::Now(); { base::AutoLock lock(lock_); - if (now - last_wakeup_time_ > base::TimeDelta::FromSeconds(kSleepSeconds)) { + if (now - last_wakeup_time_ > base::TimeDelta::FromSeconds(2)) { need_to_awaken = true; last_wakeup_time_ = now; } diff --git a/chrome/browser/metrics/thread_watcher.h b/chrome/browser/metrics/thread_watcher.h index 5bfc90b..c4efd5f 100644 --- a/chrome/browser/metrics/thread_watcher.h +++ b/chrome/browser/metrics/thread_watcher.h @@ -133,7 +133,6 @@ class ThreadWatcher { private: friend class ThreadWatcherList; - friend class CustomThreadWatcher; // Allow tests to access our innards for testing purposes. FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, Registration); @@ -152,7 +151,7 @@ class ThreadWatcher { // This method resets unresponsive_count_ to zero because watched thread is // responding to the ping message with a pong message. - void ResetHangCounters(); + void GotGoodResponse(); // This method records watched thread is not responding to the ping message. // It increments unresponsive_count_ by 1. @@ -226,7 +225,7 @@ class ThreadWatcher { int unresponsive_count_; // This is set to true when we would have crashed the browser because the - // watched thread hasn't responded atleast 6 times. It is reset to false when + // watched thread hasn't responded atleast 3 times. It is reset to false when // watched thread responds with a pong message. bool hung_processing_complete_; diff --git a/chrome/browser/metrics/thread_watcher_unittest.cc b/chrome/browser/metrics/thread_watcher_unittest.cc index c67aabf..0bc5f62 100644 --- a/chrome/browser/metrics/thread_watcher_unittest.cc +++ b/chrome/browser/metrics/thread_watcher_unittest.cc @@ -173,7 +173,7 @@ class CustomThreadWatcher : public ThreadWatcher { State exit_state; // Keep the thread that is running the tests waiting until ThreadWatcher // object's state changes to the expected_state or until wait_time elapses. - for (int i = 0; i < ThreadWatcher::kPingCount; ++i) { + for (int i = 0; i < 3; ++i) { TimeTicks end_time = TimeTicks::Now() + wait_time; { base::AutoLock auto_lock(custom_lock_); @@ -202,7 +202,7 @@ class CustomThreadWatcher : public ThreadWatcher { // Keep the thread that is running the tests waiting until ThreadWatcher // object's check_response_state_ changes to the expected_state or until // wait_time elapses. - for (int i = 0; i < ThreadWatcher::kPingCount; ++i) { + for (int i = 0; i < 3; ++i) { TimeTicks end_time = TimeTicks::Now() + wait_time; { base::AutoLock auto_lock(custom_lock_); |