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

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

Issue 1318733007: Refactor CallStackProfile::Params into base/ for use over IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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"
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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 bool JankTimeBomb::IsEnabled() const { 945 bool JankTimeBomb::IsEnabled() const {
945 version_info::Channel channel = chrome::GetChannel(); 946 version_info::Channel channel = chrome::GetChannel();
946 return channel == version_info::Channel::UNKNOWN || 947 return channel == version_info::Channel::UNKNOWN ||
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, GetJankTimeBombSamplingParams(),
Mike Wittman 2015/08/31 19:35:57 nit: move GetJankTimeBombSamplingParams(), to next
sydli 2015/08/31 20:09:42 Done.
955 GetJankTimeBombSamplingParams(),
956 metrics::CallStackProfileMetricsProvider::GetProfilerCallback( 956 metrics::CallStackProfileMetricsProvider::GetProfilerCallback(
957 metrics::CallStackProfileMetricsProvider::Params( 957 base::CallStackProfileParams(base::CallStackProfileParams::JANKY_TASK,
958 metrics::CallStackProfileMetricsProvider::JANKY_TASK, 958 true))));
959 true))));
960 // Use synchronous profiler. It will automatically stop collection when 959 // Use synchronous profiler. It will automatically stop collection when
961 // destroyed. 960 // destroyed.
962 sampling_profiler_->Start(); 961 sampling_profiler_->Start();
963 } 962 }
964 963
965 // ShutdownWatcherHelper methods and members. 964 // ShutdownWatcherHelper methods and members.
966 // 965 //
967 // ShutdownWatcherHelper is a wrapper class for detecting hangs during 966 // ShutdownWatcherHelper is a wrapper class for detecting hangs during
968 // shutdown. 967 // shutdown.
969 ShutdownWatcherHelper::ShutdownWatcherHelper() 968 ShutdownWatcherHelper::ShutdownWatcherHelper()
(...skipping 25 matching lines...) Expand all
995 994
996 #if defined(OS_WIN) 995 #if defined(OS_WIN)
997 // On Windows XP, give twice the time for shutdown. 996 // On Windows XP, give twice the time for shutdown.
998 if (base::win::GetVersion() <= base::win::VERSION_XP) 997 if (base::win::GetVersion() <= base::win::VERSION_XP)
999 actual_duration *= 2; 998 actual_duration *= 2;
1000 #endif 999 #endif
1001 1000
1002 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); 1001 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration);
1003 shutdown_watchdog_->Arm(); 1002 shutdown_watchdog_->Arm();
1004 } 1003 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698