OLD | NEW |
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" |
11 #include "base/debug/dump_without_crashing.h" | 11 #include "base/debug/dump_without_crashing.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/metrics/call_stack_profile_params.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
16 #include "base/strings/string_tokenizer.h" | 17 #include "base/strings/string_tokenizer.h" |
17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
18 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
19 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
20 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
22 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
23 #include "chrome/browser/metrics/thread_watcher_report_hang.h" | 24 #include "chrome/browser/metrics/thread_watcher_report_hang.h" |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 channel == version_info::Channel::CANARY || | 948 channel == version_info::Channel::CANARY || |
948 channel == version_info::Channel::DEV; | 949 channel == version_info::Channel::DEV; |
949 } | 950 } |
950 | 951 |
951 void JankTimeBomb::Alarm(base::PlatformThreadId thread_id) { | 952 void JankTimeBomb::Alarm(base::PlatformThreadId thread_id) { |
952 DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); | 953 DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); |
953 sampling_profiler_.reset(new base::StackSamplingProfiler( | 954 sampling_profiler_.reset(new base::StackSamplingProfiler( |
954 thread_id, | 955 thread_id, |
955 GetJankTimeBombSamplingParams(), | 956 GetJankTimeBombSamplingParams(), |
956 metrics::CallStackProfileMetricsProvider::GetProfilerCallback( | 957 metrics::CallStackProfileMetricsProvider::GetProfilerCallback( |
957 metrics::CallStackProfileMetricsProvider::Params( | 958 base::CallStackProfileParams(base::CallStackProfileParams::JANKY_TASK, |
958 metrics::CallStackProfileMetricsProvider::JANKY_TASK, | 959 true)))); |
959 true)))); | |
960 // Use synchronous profiler. It will automatically stop collection when | 960 // Use synchronous profiler. It will automatically stop collection when |
961 // destroyed. | 961 // destroyed. |
962 sampling_profiler_->Start(); | 962 sampling_profiler_->Start(); |
963 } | 963 } |
964 | 964 |
965 // ShutdownWatcherHelper methods and members. | 965 // ShutdownWatcherHelper methods and members. |
966 // | 966 // |
967 // ShutdownWatcherHelper is a wrapper class for detecting hangs during | 967 // ShutdownWatcherHelper is a wrapper class for detecting hangs during |
968 // shutdown. | 968 // shutdown. |
969 ShutdownWatcherHelper::ShutdownWatcherHelper() | 969 ShutdownWatcherHelper::ShutdownWatcherHelper() |
(...skipping 25 matching lines...) Expand all Loading... |
995 | 995 |
996 #if defined(OS_WIN) | 996 #if defined(OS_WIN) |
997 // On Windows XP, give twice the time for shutdown. | 997 // On Windows XP, give twice the time for shutdown. |
998 if (base::win::GetVersion() <= base::win::VERSION_XP) | 998 if (base::win::GetVersion() <= base::win::VERSION_XP) |
999 actual_duration *= 2; | 999 actual_duration *= 2; |
1000 #endif | 1000 #endif |
1001 | 1001 |
1002 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 1002 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
1003 shutdown_watchdog_->Arm(); | 1003 shutdown_watchdog_->Arm(); |
1004 } | 1004 } |
OLD | NEW |