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

Side by Side Diff: chrome/common/stack_sampling_configuration.cc

Issue 2702463003: NativeStackSampler implementation for Mac. (Closed)
Patch Set: fix config Created 3 years, 9 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
« no previous file with comments | « base/profiler/stack_sampling_profiler_unittest.cc ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/common/stack_sampling_configuration.h" 5 #include "chrome/common/stack_sampling_configuration.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "build/build_config.h"
10 #include "chrome/common/channel_info.h" 11 #include "chrome/common/channel_info.h"
11 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "components/version_info/version_info.h" 13 #include "components/version_info/version_info.h"
13 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
14 15
15 namespace { 16 namespace {
16 17
17 base::LazyInstance<StackSamplingConfiguration>::Leaky g_configuration = 18 base::LazyInstance<StackSamplingConfiguration>::Leaky g_configuration =
18 LAZY_INSTANCE_INITIALIZER; 19 LAZY_INSTANCE_INITIALIZER;
19 20
20 // The profiler is currently only implemented for Windows x64, and only runs on 21 // The profiler is currently only implemented for Windows x64 and Mac x64.
21 // trunk, canary, and dev.
22 bool IsProfilerSupported() { 22 bool IsProfilerSupported() {
23 #if !defined(_WIN64) 23 #if defined(OS_WIN)
Mike Wittman 2017/03/27 19:48:46 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
Avi (use Gerrit) 2017/03/29 17:52:09 Done.
24 // Only run on trunk, canary, and dev.
25 const version_info::Channel channel = chrome::GetChannel();
Mike Wittman 2017/03/27 19:48:46 Can we do this so we have the same approach wrt th
Avi (use Gerrit) 2017/03/29 17:52:09 Done.
26 return channel == version_info::Channel::UNKNOWN ||
27 channel == version_info::Channel::CANARY ||
28 channel == version_info::Channel::DEV;
29 #elif defined(OS_MACOSX)
30 // This is experimental, so only run on trunk.
31 #if defined(GOOGLE_CHROME_BUILD)
Mike Wittman 2017/03/20 19:21:30 Can you apply the same change to the OS_WIN sectio
Avi (use Gerrit) 2017/03/27 16:06:30 Done.
32 return false;
33 #else
34 return true;
35 #endif
36 #else
24 return false; 37 return false;
25 #else
26 const version_info::Channel channel = chrome::GetChannel();
27 return (channel == version_info::Channel::UNKNOWN ||
28 channel == version_info::Channel::CANARY ||
29 channel == version_info::Channel::DEV);
30 #endif 38 #endif
31 } 39 }
32 40
33 // Returns true if the current execution is taking place in the browser process. 41 // Returns true if the current execution is taking place in the browser process.
34 bool IsBrowserProcess() { 42 bool IsBrowserProcess() {
35 const base::CommandLine* command_line = 43 const base::CommandLine* command_line =
36 base::CommandLine::ForCurrentProcess(); 44 base::CommandLine::ForCurrentProcess();
37 std::string process_type = 45 std::string process_type =
38 command_line->GetSwitchValueASCII(switches::kProcessType); 46 command_line->GetSwitchValueASCII(switches::kProcessType);
39 return process_type.empty(); 47 return process_type.empty();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 { PROFILE_GPU_PROCESS, 0}, 200 { PROFILE_GPU_PROCESS, 0},
193 { PROFILE_BROWSER_AND_GPU_PROCESS, 80}, 201 { PROFILE_BROWSER_AND_GPU_PROCESS, 80},
194 { PROFILE_CONTROL, 10}, 202 { PROFILE_CONTROL, 10},
195 { PROFILE_DISABLED, 10} 203 { PROFILE_DISABLED, 10}
196 }); 204 });
197 205
198 default: 206 default:
199 return PROFILE_DISABLED; 207 return PROFILE_DISABLED;
200 } 208 }
201 } 209 }
OLDNEW
« no previous file with comments | « base/profiler/stack_sampling_profiler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698