|
7 | 7 |
|
8 | 8 | #pragma once
|
9 | 9 |
|
10 |
| -#include <ReactCommon/RuntimeExecutor.h> |
11 |
| - |
12 | 10 | #include "ConsoleMessage.h"
|
13 | 11 | #include "ExecutionContext.h"
|
14 | 12 | #include "InspectorInterfaces.h"
|
|
17 | 15 | #include "StackTrace.h"
|
18 | 16 | #include "WeakList.h"
|
19 | 17 |
|
| 18 | +#include <ReactCommon/RuntimeExecutor.h> |
| 19 | +#include <jsinspector-modern/tracing/RuntimeSamplingProfile.h> |
| 20 | + |
20 | 21 | #include <memory>
|
21 | 22 |
|
22 | 23 | #ifndef JSINSPECTOR_EXPORT
|
@@ -90,6 +91,21 @@ class RuntimeTargetDelegate {
|
90 | 91 | virtual std::unique_ptr<StackTrace> captureStackTrace(
|
91 | 92 | jsi::Runtime& runtime,
|
92 | 93 | size_t framesToSkip = 0) = 0;
|
| 94 | + |
| 95 | + /** |
| 96 | + * Start sampling profiler. |
| 97 | + */ |
| 98 | + virtual void enableSamplingProfiler() = 0; |
| 99 | + |
| 100 | + /** |
| 101 | + * Stop sampling profiler. |
| 102 | + */ |
| 103 | + virtual void disableSamplingProfiler() = 0; |
| 104 | + |
| 105 | + /** |
| 106 | + * Return recorded sampling profile for the previous sampling session. |
| 107 | + */ |
| 108 | + virtual tracing::RuntimeSamplingProfile collectSamplingProfile() = 0; |
93 | 109 | };
|
94 | 110 |
|
95 | 111 | /**
|
@@ -118,6 +134,21 @@ class RuntimeTargetController {
|
118 | 134 | */
|
119 | 135 | void notifyDebuggerSessionDestroyed();
|
120 | 136 |
|
| 137 | + /** |
| 138 | + * Start sampling profiler for the corresponding RuntimeTarget. |
| 139 | + */ |
| 140 | + void enableSamplingProfiler(); |
| 141 | + |
| 142 | + /** |
| 143 | + * Stop sampling profiler for the corresponding RuntimeTarget. |
| 144 | + */ |
| 145 | + void disableSamplingProfiler(); |
| 146 | + |
| 147 | + /** |
| 148 | + * Return recorded sampling profile for the previous sampling session. |
| 149 | + */ |
| 150 | + tracing::RuntimeSamplingProfile collectSamplingProfile(); |
| 151 | + |
121 | 152 | private:
|
122 | 153 | RuntimeTarget& target_;
|
123 | 154 | };
|
@@ -171,6 +202,21 @@ class JSINSPECTOR_EXPORT RuntimeTarget
|
171 | 202 | FrontendChannel channel,
|
172 | 203 | SessionState& sessionState);
|
173 | 204 |
|
| 205 | + /** |
| 206 | + * Start sampling profiler for a particular JavaScript runtime. |
| 207 | + */ |
| 208 | + void enableSamplingProfiler(); |
| 209 | + |
| 210 | + /** |
| 211 | + * Stop sampling profiler for a particular JavaScript runtime. |
| 212 | + */ |
| 213 | + void disableSamplingProfiler(); |
| 214 | + |
| 215 | + /** |
| 216 | + * Return recorded sampling profile for the previous sampling session. |
| 217 | + */ |
| 218 | + tracing::RuntimeSamplingProfile collectSamplingProfile(); |
| 219 | + |
174 | 220 | private:
|
175 | 221 | /**
|
176 | 222 | * Constructs a new RuntimeTarget. The caller must call setExecutor
|
|
0 commit comments