Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_STACK_SAMPLING_CONFIGURATION_H_ | 5 #ifndef CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_ |
| 6 #define CHROME_BROWSER_STACK_SAMPLING_CONFIGURATION_H_ | 6 #define CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/profiler/stack_sampling_profiler.h" | 9 #include "base/profiler/stack_sampling_profiler.h" |
| 10 | 10 |
| 11 // Chooses a configuration for the stack sampling profiler for browser process | 11 // Chooses a configuration for the stack sampling profiler for browser process |
| 12 // startup. This must live outside of ChromeBrowserMainParts so it can be | 12 // startup. This must live outside of ChromeBrowserMainParts so it can be |
| 13 // friended by ChromeMetricsServiceAccessor. | 13 // friended by ChromeMetricsServiceAccessor. |
| 14 class StackSamplingConfiguration { | 14 class StackSamplingConfiguration { |
| 15 public: | 15 public: |
| 16 // This callback indirection is required to avoid a DEPS on | |
| 17 // chrome/browser/metrics. | |
| 18 using RegisterSyntheticFieldTrialFunction = base::Callback<bool( | |
| 19 const std::string& trial_name, | |
| 20 const std::string& group_name)>; | |
|
Ilya Sherman
2016/09/28 00:48:27
nit: Please leave a blank newline after this line.
Mike Wittman
2016/09/28 19:31:11
Done.
| |
| 16 StackSamplingConfiguration(); | 21 StackSamplingConfiguration(); |
| 17 | 22 |
| 18 // Get the stack sampling params to use for this session. | 23 // Get the stack sampling params to use for this session. |
| 19 base::StackSamplingProfiler::SamplingParams GetSamplingParams() const; | 24 base::StackSamplingProfiler::SamplingParams GetSamplingParams() const; |
| 20 | 25 |
| 21 // Returns true if the profiler should be started at all. | 26 // Returns true if the profiler should be started at all. |
| 22 bool IsProfilerEnabled() const; | 27 bool IsProfilerEnabled() const; |
| 23 | 28 |
| 24 // Register the chosen configuration as a synthetic field trial. | 29 // Register the chosen configuration as a synthetic field trial. |
| 25 void RegisterSyntheticFieldTrial() const; | 30 void RegisterSyntheticFieldTrial( |
| 31 const RegisterSyntheticFieldTrialFunction& register_field_trial) const; | |
| 26 | 32 |
| 27 private: | 33 private: |
| 28 enum ProfileConfiguration { | 34 enum ProfileConfiguration { |
| 29 PROFILE_DISABLED, | 35 PROFILE_DISABLED, |
| 30 PROFILE_CONTROL, | 36 PROFILE_CONTROL, |
| 31 PROFILE_NO_SAMPLES, // Run the profiler thread, but don't collect profiles. | 37 PROFILE_NO_SAMPLES, // Run the profiler thread, but don't collect profiles. |
| 32 PROFILE_5HZ, | 38 PROFILE_5HZ, |
| 33 PROFILE_10HZ, | 39 PROFILE_10HZ, |
| 34 PROFILE_100HZ | 40 PROFILE_100HZ |
| 35 }; | 41 }; |
| 36 | 42 |
| 37 static ProfileConfiguration GenerateConfiguration(); | 43 static ProfileConfiguration GenerateConfiguration(); |
| 38 | 44 |
| 39 const ProfileConfiguration configuration_; | 45 const ProfileConfiguration configuration_; |
| 40 | 46 |
| 41 DISALLOW_COPY_AND_ASSIGN(StackSamplingConfiguration); | 47 DISALLOW_COPY_AND_ASSIGN(StackSamplingConfiguration); |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 #endif // CHROME_BROWSER_STACK_SAMPLING_CONFIGURATION_H_ | 50 #endif // CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_ |
| OLD | NEW |