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 <vector> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
11 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
12 #include "components/metrics/public/interfaces/call_stack_profile_collector.mojo
m.h" | 14 #include "components/metrics/public/interfaces/call_stack_profile_collector.mojo
m.h" |
13 | 15 |
14 namespace service_manager { | 16 namespace service_manager { |
15 class InterfaceProvider; | 17 class InterfaceProvider; |
16 } | 18 } |
17 | 19 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 85 |
84 // The sampled profiles. | 86 // The sampled profiles. |
85 base::StackSamplingProfiler::CallStackProfiles profiles; | 87 base::StackSamplingProfiler::CallStackProfiles profiles; |
86 | 88 |
87 private: | 89 private: |
88 DISALLOW_COPY_AND_ASSIGN(ProfilesState); | 90 DISALLOW_COPY_AND_ASSIGN(ProfilesState); |
89 }; | 91 }; |
90 | 92 |
91 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; | 93 using CallStackProfile = base::StackSamplingProfiler::CallStackProfile; |
92 | 94 |
93 void Collect(const CallStackProfileParams& params, | 95 base::Optional<base::StackSamplingProfiler::SamplingParams> Collect( |
94 base::TimeTicks start_timestamp, | 96 const CallStackProfileParams& params, |
95 std::vector<CallStackProfile> profiles); | 97 base::TimeTicks start_timestamp, |
| 98 std::vector<CallStackProfile> profiles); |
| 99 |
| 100 void CollectImpl(const CallStackProfileParams& params, |
| 101 base::TimeTicks start_timestamp, |
| 102 std::vector<CallStackProfile> profiles); |
96 | 103 |
97 // This object may be accessed on any thread, including the profiler | 104 // 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 | 105 // 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 | 106 // GetProfilerCallback before the message loop starts, which prevents the use |
100 // of PostTask and the like for inter-thread communication. | 107 // of PostTask and the like for inter-thread communication. |
101 base::Lock lock_; | 108 base::Lock lock_; |
102 | 109 |
103 // Whether to retain profiles when the interface is not set. Remains true | 110 // Whether to retain profiles when the interface is not set. Remains true |
104 // until the invocation of SetParentProfileCollector(), at which point it is | 111 // until the invocation of SetParentProfileCollector(), at which point it is |
105 // false for the rest of the object lifetime. | 112 // 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 | 124 // Profiles being cached by this object, pending a parent interface to be |
118 // supplied. | 125 // supplied. |
119 std::vector<ProfilesState> profiles_; | 126 std::vector<ProfilesState> profiles_; |
120 | 127 |
121 DISALLOW_COPY_AND_ASSIGN(ChildCallStackProfileCollector); | 128 DISALLOW_COPY_AND_ASSIGN(ChildCallStackProfileCollector); |
122 }; | 129 }; |
123 | 130 |
124 } // namespace metrics | 131 } // namespace metrics |
125 | 132 |
126 #endif // COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ | 133 #endif // COMPONENTS_METRICS_CHILD_CALL_STACK_PROFILE_COLLECTOR_H_ |
OLD | NEW |