js_protocol/heapprofiler/
mod.rs1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3
4pub type HeapSnapshotObjectId = String;
7
8#[derive(Debug, Clone, Serialize, Deserialize, Default)]
11#[serde(rename_all = "camelCase")]
12pub struct SamplingHeapProfileNode {
13 pub callFrame: crate::runtime::CallFrame,
16 pub selfSize: f64,
19 pub id: u64,
22 pub children: Vec<SamplingHeapProfileNode>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize, Default)]
30#[serde(rename_all = "camelCase")]
31pub struct SamplingHeapProfileSample {
32 pub size: f64,
35 pub nodeId: u64,
38 pub ordinal: f64,
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize, Default)]
47#[serde(rename_all = "camelCase")]
48pub struct SamplingHeapProfile {
49
50 pub head: SamplingHeapProfileNode,
51
52 pub samples: Vec<SamplingHeapProfileSample>,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize, Default)]
59#[serde(rename_all = "camelCase")]
60pub struct AddInspectedHeapObjectParams {
61 pub heapObjectId: HeapSnapshotObjectId,
64}
65
66impl AddInspectedHeapObjectParams { pub const METHOD: &'static str = "HeapProfiler.addInspectedHeapObject"; }
67
68impl crate::CdpCommand for AddInspectedHeapObjectParams {
69 const METHOD: &'static str = "HeapProfiler.addInspectedHeapObject";
70 type Response = crate::EmptyReturns;
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize, Default)]
74pub struct CollectGarbageParams {}
75
76impl CollectGarbageParams { pub const METHOD: &'static str = "HeapProfiler.collectGarbage"; }
77
78impl crate::CdpCommand for CollectGarbageParams {
79 const METHOD: &'static str = "HeapProfiler.collectGarbage";
80 type Response = crate::EmptyReturns;
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize, Default)]
84pub struct DisableParams {}
85
86impl DisableParams { pub const METHOD: &'static str = "HeapProfiler.disable"; }
87
88impl crate::CdpCommand for DisableParams {
89 const METHOD: &'static str = "HeapProfiler.disable";
90 type Response = crate::EmptyReturns;
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize, Default)]
94pub struct EnableParams {}
95
96impl EnableParams { pub const METHOD: &'static str = "HeapProfiler.enable"; }
97
98impl crate::CdpCommand for EnableParams {
99 const METHOD: &'static str = "HeapProfiler.enable";
100 type Response = crate::EmptyReturns;
101}
102
103
104#[derive(Debug, Clone, Serialize, Deserialize, Default)]
105#[serde(rename_all = "camelCase")]
106pub struct GetHeapObjectIdParams {
107 pub objectId: crate::runtime::RemoteObjectId,
110}
111
112
113#[derive(Debug, Clone, Serialize, Deserialize, Default)]
114#[serde(rename_all = "camelCase")]
115pub struct GetHeapObjectIdReturns {
116 pub heapSnapshotObjectId: HeapSnapshotObjectId,
119}
120
121impl GetHeapObjectIdParams { pub const METHOD: &'static str = "HeapProfiler.getHeapObjectId"; }
122
123impl crate::CdpCommand for GetHeapObjectIdParams {
124 const METHOD: &'static str = "HeapProfiler.getHeapObjectId";
125 type Response = GetHeapObjectIdReturns;
126}
127
128
129#[derive(Debug, Clone, Serialize, Deserialize, Default)]
130#[serde(rename_all = "camelCase")]
131pub struct GetObjectByHeapObjectIdParams {
132
133 pub objectId: HeapSnapshotObjectId,
134 #[serde(skip_serializing_if = "Option::is_none")]
137 pub objectGroup: Option<String>,
138}
139
140
141#[derive(Debug, Clone, Serialize, Deserialize, Default)]
142#[serde(rename_all = "camelCase")]
143pub struct GetObjectByHeapObjectIdReturns {
144 pub result: crate::runtime::RemoteObject,
147}
148
149impl GetObjectByHeapObjectIdParams { pub const METHOD: &'static str = "HeapProfiler.getObjectByHeapObjectId"; }
150
151impl crate::CdpCommand for GetObjectByHeapObjectIdParams {
152 const METHOD: &'static str = "HeapProfiler.getObjectByHeapObjectId";
153 type Response = GetObjectByHeapObjectIdReturns;
154}
155
156
157#[derive(Debug, Clone, Serialize, Deserialize, Default)]
158#[serde(rename_all = "camelCase")]
159pub struct GetSamplingProfileReturns {
160 pub profile: SamplingHeapProfile,
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize, Default)]
166pub struct GetSamplingProfileParams {}
167
168impl GetSamplingProfileParams { pub const METHOD: &'static str = "HeapProfiler.getSamplingProfile"; }
169
170impl crate::CdpCommand for GetSamplingProfileParams {
171 const METHOD: &'static str = "HeapProfiler.getSamplingProfile";
172 type Response = GetSamplingProfileReturns;
173}
174
175
176#[derive(Debug, Clone, Serialize, Deserialize, Default)]
177#[serde(rename_all = "camelCase")]
178pub struct StartSamplingParams {
179 #[serde(skip_serializing_if = "Option::is_none")]
183 pub samplingInterval: Option<f64>,
184 #[serde(skip_serializing_if = "Option::is_none")]
187 pub stackDepth: Option<f64>,
188 #[serde(skip_serializing_if = "Option::is_none")]
197 pub includeObjectsCollectedByMajorGC: Option<bool>,
198 #[serde(skip_serializing_if = "Option::is_none")]
207 pub includeObjectsCollectedByMinorGC: Option<bool>,
208}
209
210impl StartSamplingParams { pub const METHOD: &'static str = "HeapProfiler.startSampling"; }
211
212impl crate::CdpCommand for StartSamplingParams {
213 const METHOD: &'static str = "HeapProfiler.startSampling";
214 type Response = crate::EmptyReturns;
215}
216
217
218#[derive(Debug, Clone, Serialize, Deserialize, Default)]
219#[serde(rename_all = "camelCase")]
220pub struct StartTrackingHeapObjectsParams {
221
222 #[serde(skip_serializing_if = "Option::is_none")]
223 pub trackAllocations: Option<bool>,
224}
225
226impl StartTrackingHeapObjectsParams { pub const METHOD: &'static str = "HeapProfiler.startTrackingHeapObjects"; }
227
228impl crate::CdpCommand for StartTrackingHeapObjectsParams {
229 const METHOD: &'static str = "HeapProfiler.startTrackingHeapObjects";
230 type Response = crate::EmptyReturns;
231}
232
233
234#[derive(Debug, Clone, Serialize, Deserialize, Default)]
235#[serde(rename_all = "camelCase")]
236pub struct StopSamplingReturns {
237 pub profile: SamplingHeapProfile,
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize, Default)]
243pub struct StopSamplingParams {}
244
245impl StopSamplingParams { pub const METHOD: &'static str = "HeapProfiler.stopSampling"; }
246
247impl crate::CdpCommand for StopSamplingParams {
248 const METHOD: &'static str = "HeapProfiler.stopSampling";
249 type Response = StopSamplingReturns;
250}
251
252
253#[derive(Debug, Clone, Serialize, Deserialize, Default)]
254#[serde(rename_all = "camelCase")]
255pub struct StopTrackingHeapObjectsParams {
256 #[serde(skip_serializing_if = "Option::is_none")]
260 pub reportProgress: Option<bool>,
261 #[serde(skip_serializing_if = "Option::is_none")]
264 pub treatGlobalObjectsAsRoots: Option<bool>,
265 #[serde(skip_serializing_if = "Option::is_none")]
268 pub captureNumericValue: Option<bool>,
269 #[serde(skip_serializing_if = "Option::is_none")]
272 pub exposeInternals: Option<bool>,
273}
274
275impl StopTrackingHeapObjectsParams { pub const METHOD: &'static str = "HeapProfiler.stopTrackingHeapObjects"; }
276
277impl crate::CdpCommand for StopTrackingHeapObjectsParams {
278 const METHOD: &'static str = "HeapProfiler.stopTrackingHeapObjects";
279 type Response = crate::EmptyReturns;
280}
281
282
283#[derive(Debug, Clone, Serialize, Deserialize, Default)]
284#[serde(rename_all = "camelCase")]
285pub struct TakeHeapSnapshotParams {
286 #[serde(skip_serializing_if = "Option::is_none")]
289 pub reportProgress: Option<bool>,
290 #[serde(skip_serializing_if = "Option::is_none")]
294 pub treatGlobalObjectsAsRoots: Option<bool>,
295 #[serde(skip_serializing_if = "Option::is_none")]
298 pub captureNumericValue: Option<bool>,
299 #[serde(skip_serializing_if = "Option::is_none")]
302 pub exposeInternals: Option<bool>,
303}
304
305impl TakeHeapSnapshotParams { pub const METHOD: &'static str = "HeapProfiler.takeHeapSnapshot"; }
306
307impl crate::CdpCommand for TakeHeapSnapshotParams {
308 const METHOD: &'static str = "HeapProfiler.takeHeapSnapshot";
309 type Response = crate::EmptyReturns;
310}