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

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

Issue 2927593002: Make stack sampling profiler sample beyond startup. (Closed)
Patch Set: rebase + PROFILER_TEST_F Created 3 years, 6 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 | « chrome/common/DEPS ('k') | chrome/common/stack_sampling_configuration.cc » ('j') | 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 #ifndef CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_ 5 #ifndef CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_
6 #define CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_ 6 #define CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/profiler/stack_sampling_profiler.h" 12 #include "base/profiler/stack_sampling_profiler.h"
13 #include "components/metrics/call_stack_profile_metrics_provider.h"
13 14
14 namespace base { 15 namespace base {
15 class CommandLine; 16 class CommandLine;
16 } // namespace base 17 } // namespace base
17 18
18 // StackSamplingConfiguration chooses a configuration for the enable state of 19 // StackSamplingConfiguration chooses a configuration for the enable state of
19 // the stack sampling profiler across all processes. This configuration is 20 // the stack sampling profiler across all processes. This configuration is
20 // determined once at browser process startup. Configurations for child 21 // determined once at browser process startup. Configurations for child
21 // processes are communicated via command line arguments. 22 // processes are communicated via command line arguments.
22 class StackSamplingConfiguration { 23 class StackSamplingConfiguration {
23 public: 24 public:
24 StackSamplingConfiguration(); 25 StackSamplingConfiguration();
25 26
26 // Get the stack sampling params to use for this process. 27 // Get the stack sampling params to use for this process.
27 base::StackSamplingProfiler::SamplingParams 28 base::StackSamplingProfiler::SamplingParams
28 GetSamplingParamsForCurrentProcess() const; 29 GetSamplingParamsForCurrentProcess() const;
30
31 // Returns the profiler callback to use for this process.
32 base::StackSamplingProfiler::CompletedCallback
33 GetProfilerCallbackForCurrentProcess();
Mike Wittman 2017/06/21 14:49:06 If we have a unified function for getting the call
Alexei Svitkine (slow) 2017/06/29 20:51:04 Did you have some thoughts on how to organize this
Mike Wittman 2017/07/01 02:44:06 I'd recommend creating a function here like base::
Alexei Svitkine (slow) 2017/07/06 15:51:09 So if we go with this approach, then we need to ch
Mike Wittman 2017/07/06 17:25:52 Good point. Perhaps we should move both the wrappe
Alexei Svitkine (slow) 2017/07/06 19:36:25 It gets a bit messy: - We'll need to also expose
Mike Wittman 2017/07/06 22:14:01 Leaving for a later CL sgtm if it's going to be in
Alexei Svitkine (slow) 2017/07/07 16:18:48 The changes to StackSamplingConfiguration are need
Mike Wittman 2017/07/07 18:15:17 How about storing the CallStackProfileParams along
Alexei Svitkine (slow) 2017/07/07 19:04:14 Done. I still think it would be nice to move some
29 34
30 // Returns true if the profiler should be started for the current process. 35 // Returns true if the profiler should be started for the current process.
31 bool IsProfilerEnabledForCurrentProcess() const; 36 bool IsProfilerEnabledForCurrentProcess() const;
32 37
33 // Get the synthetic field trial configuration. Returns true if a synthetic 38 // Get the synthetic field trial configuration. Returns true if a synthetic
34 // field trial should be registered. This should only be called from the 39 // field trial should be registered. This should only be called from the
35 // browser process. When run at startup, the profiler must use a synthetic 40 // browser process. When run at startup, the profiler must use a synthetic
36 // field trial since it runs before the metrics field trials are initialized. 41 // field trial since it runs before the metrics field trials are initialized.
37 bool GetSyntheticFieldTrial(std::string* trial_name, 42 bool GetSyntheticFieldTrial(std::string* trial_name,
38 std::string* group_name) const; 43 std::string* group_name) const;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const std::vector<Variation>& variations); 79 const std::vector<Variation>& variations);
75 80
76 // Generates sampling profiler configurations for all processes. 81 // Generates sampling profiler configurations for all processes.
77 static ProfileConfiguration GenerateConfiguration(); 82 static ProfileConfiguration GenerateConfiguration();
78 83
79 // In the browser process this represents the configuration to use across all 84 // In the browser process this represents the configuration to use across all
80 // Chrome processes. In the child processes it is always 85 // Chrome processes. In the child processes it is always
81 // PROFILE_FROM_COMMAND_LINE. 86 // PROFILE_FROM_COMMAND_LINE.
82 const ProfileConfiguration configuration_; 87 const ProfileConfiguration configuration_;
83 88
89 // The current profiling params. Not const since these may be changed when
90 // transitioning from start-up profiling to periodic profiling.
91 metrics::CallStackProfileParams profile_params_;
92
84 DISALLOW_COPY_AND_ASSIGN(StackSamplingConfiguration); 93 DISALLOW_COPY_AND_ASSIGN(StackSamplingConfiguration);
85 }; 94 };
86 95
87 #endif // CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_ 96 #endif // CHROME_COMMON_STACK_SAMPLING_CONFIGURATION_H_
OLDNEW
« no previous file with comments | « chrome/common/DEPS ('k') | chrome/common/stack_sampling_configuration.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698