| OLD | NEW |
| 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 "chrome/common/channel_info.h" | 10 #include "chrome/common/channel_info.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 return !group_name->empty(); | 122 return !group_name->empty(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void StackSamplingConfiguration::AppendCommandLineSwitchForChildProcess( | 125 void StackSamplingConfiguration::AppendCommandLineSwitchForChildProcess( |
| 126 const std::string& process_type, | 126 const std::string& process_type, |
| 127 base::CommandLine* command_line) const { | 127 base::CommandLine* command_line) const { |
| 128 DCHECK(IsBrowserProcess()); | 128 DCHECK(IsBrowserProcess()); |
| 129 | 129 |
| 130 if (process_type == switches::kGpuProcess && | 130 if (process_type == switches::kGpuProcess && |
| 131 (configuration_ == PROFILE_GPU_PROCESS || | 131 (configuration_ == PROFILE_CONTROL || |
| 132 configuration_ == PROFILE_GPU_PROCESS || |
| 132 configuration_ == PROFILE_BROWSER_AND_GPU_PROCESS)) { | 133 configuration_ == PROFILE_BROWSER_AND_GPU_PROCESS)) { |
| 133 command_line->AppendSwitch(switches::kStartStackProfiler); | 134 command_line->AppendSwitch(switches::kStartStackProfiler); |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 | 137 |
| 137 // static | 138 // static |
| 138 StackSamplingConfiguration* StackSamplingConfiguration::Get() { | 139 StackSamplingConfiguration* StackSamplingConfiguration::Get() { |
| 139 return g_configuration.Pointer(); | 140 return g_configuration.Pointer(); |
| 140 } | 141 } |
| 141 | 142 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 switch (chrome::GetChannel()) { | 174 switch (chrome::GetChannel()) { |
| 174 // Enable the profiler in the ultimate production configuration for | 175 // Enable the profiler in the ultimate production configuration for |
| 175 // development/waterfall builds. | 176 // development/waterfall builds. |
| 176 case version_info::Channel::UNKNOWN: | 177 case version_info::Channel::UNKNOWN: |
| 177 return PROFILE_BROWSER_AND_GPU_PROCESS; | 178 return PROFILE_BROWSER_AND_GPU_PROCESS; |
| 178 | 179 |
| 179 case version_info::Channel::CANARY: | 180 case version_info::Channel::CANARY: |
| 180 return ChooseConfiguration({ | 181 return ChooseConfiguration({ |
| 181 { PROFILE_BROWSER_PROCESS, 0}, | 182 { PROFILE_BROWSER_PROCESS, 0}, |
| 182 { PROFILE_GPU_PROCESS, 0}, | 183 { PROFILE_GPU_PROCESS, 0}, |
| 183 { PROFILE_BROWSER_AND_GPU_PROCESS, 50}, | 184 { PROFILE_BROWSER_AND_GPU_PROCESS, 80}, |
| 184 { PROFILE_CONTROL, 50}, | 185 { PROFILE_CONTROL, 10}, |
| 185 { PROFILE_DISABLED, 0} | 186 { PROFILE_DISABLED, 10} |
| 186 }); | 187 }); |
| 187 | 188 |
| 188 case version_info::Channel::DEV: | 189 case version_info::Channel::DEV: |
| 189 return ChooseConfiguration({ | 190 return ChooseConfiguration({ |
| 190 { PROFILE_BROWSER_PROCESS, 0}, | 191 { PROFILE_BROWSER_PROCESS, 0}, |
| 191 { PROFILE_GPU_PROCESS, 0}, | 192 { PROFILE_GPU_PROCESS, 0}, |
| 192 { PROFILE_BROWSER_AND_GPU_PROCESS, 50}, | 193 { PROFILE_BROWSER_AND_GPU_PROCESS, 80}, |
| 193 { PROFILE_CONTROL, 50}, | 194 { PROFILE_CONTROL, 10}, |
| 194 { PROFILE_DISABLED, 0} | 195 { PROFILE_DISABLED, 10} |
| 195 }); | 196 }); |
| 196 | 197 |
| 197 default: | 198 default: |
| 198 return PROFILE_DISABLED; | 199 return PROFILE_DISABLED; |
| 199 } | 200 } |
| 200 } | 201 } |
| OLD | NEW |