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

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

Issue 7744015: Increased the unresponsive threshold from 6 to 12 in beta (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/string_tokenizer.h" 10 #include "base/string_tokenizer.h"
11 #include "base/threading/thread_restrictions.h" 11 #include "base/threading/thread_restrictions.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/metrics/metrics_service.h" 13 #include "chrome/browser/metrics/metrics_service.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/chrome_version_info.h" 15 #include "chrome/common/chrome_version_info.h"
16 #include "content/common/notification_service.h" 16 #include "content/common/notification_service.h"
17 17
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 #include <Objbase.h> 19 #include "base/win/windows_version.h"
20 #endif 20 #endif
21 21
22 // static 22 // static
23 const int ThreadWatcher::kPingCount = 6; 23 const int ThreadWatcher::kPingCount = 6;
24 24
25 // ThreadWatcher methods and members. 25 // ThreadWatcher methods and members.
26 ThreadWatcher::ThreadWatcher(const BrowserThread::ID& thread_id, 26 ThreadWatcher::ThreadWatcher(const BrowserThread::ID& thread_id,
27 const std::string& thread_name, 27 const std::string& thread_name,
28 const base::TimeDelta& sleep_time, 28 const base::TimeDelta& sleep_time,
29 const base::TimeDelta& unresponsive_time, 29 const base::TimeDelta& unresponsive_time,
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 410 }
411 411
412 // static 412 // static
413 void ThreadWatcherList::ParseCommandLine( 413 void ThreadWatcherList::ParseCommandLine(
414 const CommandLine& command_line, 414 const CommandLine& command_line,
415 uint32* unresponsive_threshold, 415 uint32* unresponsive_threshold,
416 std::set<std::string>* crash_on_hang_thread_names, 416 std::set<std::string>* crash_on_hang_thread_names,
417 uint32* live_threads_threshold) { 417 uint32* live_threads_threshold) {
418 // Determine |unresponsive_threshold| based on switches::kCrashOnHangSeconds. 418 // Determine |unresponsive_threshold| based on switches::kCrashOnHangSeconds.
419 *unresponsive_threshold = kUnresponsiveCount; 419 *unresponsive_threshold = kUnresponsiveCount;
420
421 if (chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_BETA) {
422 // Increase the unresponsive_threshold in Beta channel to reduce the number
423 // of crashes due to ThreadWatcher.
424 *unresponsive_threshold *= 2;
425 } else {
426 // In Canary and Dev channels, for Windows XP (old systems), double the
427 // unresponsive_threshold to give OS a chance to schedule UI/IO threads a
428 // time slice to respond with a pong message (to get around limitations with
429 // the OS).
430 #if defined(OS_WIN)
431 if (base::win::GetVersion() <= base::win::VERSION_XP)
432 *unresponsive_threshold *= 2;
433 #endif
434 }
435
420 std::string crash_on_hang_seconds = 436 std::string crash_on_hang_seconds =
421 command_line.GetSwitchValueASCII(switches::kCrashOnHangSeconds); 437 command_line.GetSwitchValueASCII(switches::kCrashOnHangSeconds);
422 if (!crash_on_hang_seconds.empty()) { 438 if (!crash_on_hang_seconds.empty()) {
423 int crash_seconds = atoi(crash_on_hang_seconds.c_str()); 439 int crash_seconds = atoi(crash_on_hang_seconds.c_str());
424 if (crash_seconds > 0) { 440 if (crash_seconds > 0) {
425 *unresponsive_threshold = static_cast<uint32>( 441 *unresponsive_threshold = static_cast<uint32>(
426 ceil(static_cast<float>(crash_seconds) / kUnresponsiveSeconds)); 442 ceil(static_cast<float>(crash_seconds) / kUnresponsiveSeconds));
427 } 443 }
428 } 444 }
429 445
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 674
659 base::AutoLock lock(lock_); 675 base::AutoLock lock(lock_);
660 CHECK(!watchdog_thread_); 676 CHECK(!watchdog_thread_);
661 watchdog_thread_ = this; 677 watchdog_thread_ = this;
662 } 678 }
663 679
664 void WatchDogThread::CleanUp() { 680 void WatchDogThread::CleanUp() {
665 base::AutoLock lock(lock_); 681 base::AutoLock lock(lock_);
666 watchdog_thread_ = NULL; 682 watchdog_thread_ = NULL;
667 } 683 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698