OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ | 5 #ifndef COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ |
6 #define COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ | 6 #define COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // The sampled profiles. | 84 // The sampled profiles. |
85 base::StackSamplingProfiler::CallStackProfiles profiles; | 85 base::StackSamplingProfiler::CallStackProfiles profiles; |
86 | 86 |
87 private: | 87 private: |
88 DISALLOW_COPY_AND_ASSIGN(ProfilesState); | 88 DISALLOW_COPY_AND_ASSIGN(ProfilesState); |
89 }; | 89 }; |
90 | 90 |
91 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; | 91 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; |
92 | 92 |
93 void Collect(const CallStackProfileParams& params, | 93 base::Optional<base::StackSamplingProfiler::SamplingParams> Collect( |
94 base::TimeTicks start_timestamp, | 94 const CallStackProfileParams& params, |
95 std::vector<CallStackProfile> profiles); | 95 base::TimeTicks start_timestamp, |
| 96 std::vector<CallStackProfile> profiles); |
| 97 |
| 98 void CollectImpl(const CallStackProfileParams& params, |
| 99 base::TimeTicks start_timestamp, |
| 100 std::vector<CallStackProfile> profiles); |
96 | 101 |
97 // This object may be accessed on any thread, including the profiler | 102 // This object may be accessed on any thread, including the profiler |
98 // thread. The expected use case for the object is to be created and have | 103 // thread. The expected use case for the object is to be created and have |
99 // GetProfilerCallback before the message loop starts, which prevents the use | 104 // GetProfilerCallback before the message loop starts, which prevents the use |
100 // of PostTask and the like for inter-thread communication. | 105 // of PostTask and the like for inter-thread communication. |
101 base::Lock lock_; | 106 base::Lock lock_; |
102 | 107 |
103 // Whether to retain profiles when the interface is not set. Remains true | 108 // Whether to retain profiles when the interface is not set. Remains true |
104 // until the invocation of SetParentProfileCollector(), at which point it is | 109 // until the invocation of SetParentProfileCollector(), at which point it is |
105 // false for the rest of the object lifetime. | 110 // false for the rest of the object lifetime. |
(...skipping 11 matching lines...) Expand all Loading... |
117 // Profiles being cached by this object, pending a parent interface to be | 122 // Profiles being cached by this object, pending a parent interface to be |
118 // supplied. | 123 // supplied. |
119 std::vector<ProfilesState> profiles_; | 124 std::vector<ProfilesState> profiles_; |
120 | 125 |
121 DISALLOW_COPY_AND_ASSIGN(ChildCallStackProfileCollector); | 126 DISALLOW_COPY_AND_ASSIGN(ChildCallStackProfileCollector); |
122 }; | 127 }; |
123 | 128 |
124 } // namespace metrics | 129 } // namespace metrics |
125 | 130 |
126 #endif // COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ | 131 #endif // COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ |
OLD | NEW |