1use serde::{Deserialize, Serialize};
13
14pub type HeapSnapshotObjectId = String;
16
17#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
20pub struct SamplingHeapProfileNode {
21 #[serde(rename = "callFrame")]
23 pub call_frame: crate::protocol::runtime::CallFrame,
24 #[serde(rename = "selfSize")]
26 pub self_size: f64,
27 pub id: i64,
30 pub children: Vec<SamplingHeapProfileNode>,
32}
33
34#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
36pub struct SamplingHeapProfileSample {
37 pub size: f64,
39 #[serde(rename = "nodeId")]
41 pub node_id: i64,
42 pub ordinal: f64,
45}
46
47#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
49pub struct SamplingHeapProfile {
50 pub head: SamplingHeapProfileNode,
51 pub samples: Vec<SamplingHeapProfileSample>,
52}
53
54#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
59pub struct AddInspectedHeapObjectParams {
60 #[serde(rename = "heapObjectId")]
62 pub heap_object_id: HeapSnapshotObjectId,
63}
64
65impl crate::typed::Command for AddInspectedHeapObjectParams {
66 const METHOD: &'static str = "HeapProfiler.addInspectedHeapObject";
67 type Returns = crate::typed::NoReturns;
68}
69
70#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
72pub struct CollectGarbageParams {}
73
74impl crate::typed::Command for CollectGarbageParams {
75 const METHOD: &'static str = "HeapProfiler.collectGarbage";
76 type Returns = crate::typed::NoReturns;
77}
78
79#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
81pub struct DisableParams {}
82
83impl crate::typed::Command for DisableParams {
84 const METHOD: &'static str = "HeapProfiler.disable";
85 type Returns = crate::typed::NoReturns;
86}
87
88#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
90pub struct EnableParams {}
91
92impl crate::typed::Command for EnableParams {
93 const METHOD: &'static str = "HeapProfiler.enable";
94 type Returns = crate::typed::NoReturns;
95}
96
97#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
99pub struct GetHeapObjectIdParams {
100 #[serde(rename = "objectId")]
102 pub object_id: crate::protocol::runtime::RemoteObjectId,
103}
104
105#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
107pub struct GetHeapObjectIdReturns {
108 #[serde(rename = "heapSnapshotObjectId")]
111 pub heap_snapshot_object_id: HeapSnapshotObjectId,
112}
113
114impl crate::typed::Command for GetHeapObjectIdParams {
115 const METHOD: &'static str = "HeapProfiler.getHeapObjectId";
116 type Returns = GetHeapObjectIdReturns;
117}
118
119#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
121pub struct GetObjectByHeapObjectIdParams {
122 #[serde(rename = "objectId")]
123 pub object_id: HeapSnapshotObjectId,
124 #[serde(
126 rename = "objectGroup",
127 default,
128 skip_serializing_if = "Option::is_none"
129 )]
130 pub object_group: Option<String>,
131}
132
133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
135pub struct GetObjectByHeapObjectIdReturns {
136 pub result: crate::protocol::runtime::RemoteObject,
138}
139
140impl crate::typed::Command for GetObjectByHeapObjectIdParams {
141 const METHOD: &'static str = "HeapProfiler.getObjectByHeapObjectId";
142 type Returns = GetObjectByHeapObjectIdReturns;
143}
144
145#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
147pub struct GetSamplingProfileParams {}
148
149#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
151pub struct GetSamplingProfileReturns {
152 pub profile: SamplingHeapProfile,
154}
155
156impl crate::typed::Command for GetSamplingProfileParams {
157 const METHOD: &'static str = "HeapProfiler.getSamplingProfile";
158 type Returns = GetSamplingProfileReturns;
159}
160
161#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
163pub struct StartSamplingParams {
164 #[serde(
167 rename = "samplingInterval",
168 default,
169 skip_serializing_if = "Option::is_none"
170 )]
171 pub sampling_interval: Option<f64>,
172 #[serde(
174 rename = "stackDepth",
175 default,
176 skip_serializing_if = "Option::is_none"
177 )]
178 pub stack_depth: Option<f64>,
179 #[serde(
187 rename = "includeObjectsCollectedByMajorGC",
188 default,
189 skip_serializing_if = "Option::is_none"
190 )]
191 pub include_objects_collected_by_major_gc: Option<bool>,
192 #[serde(
200 rename = "includeObjectsCollectedByMinorGC",
201 default,
202 skip_serializing_if = "Option::is_none"
203 )]
204 pub include_objects_collected_by_minor_gc: Option<bool>,
205}
206
207impl crate::typed::Command for StartSamplingParams {
208 const METHOD: &'static str = "HeapProfiler.startSampling";
209 type Returns = crate::typed::NoReturns;
210}
211
212#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
214pub struct StartTrackingHeapObjectsParams {
215 #[serde(
216 rename = "trackAllocations",
217 default,
218 skip_serializing_if = "Option::is_none"
219 )]
220 pub track_allocations: Option<bool>,
221}
222
223impl crate::typed::Command for StartTrackingHeapObjectsParams {
224 const METHOD: &'static str = "HeapProfiler.startTrackingHeapObjects";
225 type Returns = crate::typed::NoReturns;
226}
227
228#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
230pub struct StopSamplingParams {}
231
232#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
234pub struct StopSamplingReturns {
235 pub profile: SamplingHeapProfile,
237}
238
239impl crate::typed::Command for StopSamplingParams {
240 const METHOD: &'static str = "HeapProfiler.stopSampling";
241 type Returns = StopSamplingReturns;
242}
243
244#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
246pub struct StopTrackingHeapObjectsParams {
247 #[serde(
250 rename = "reportProgress",
251 default,
252 skip_serializing_if = "Option::is_none"
253 )]
254 pub report_progress: Option<bool>,
255 #[serde(
259 rename = "treatGlobalObjectsAsRoots",
260 default,
261 skip_serializing_if = "Option::is_none"
262 )]
263 pub treat_global_objects_as_roots: Option<bool>,
264 #[serde(
266 rename = "captureNumericValue",
267 default,
268 skip_serializing_if = "Option::is_none"
269 )]
270 pub capture_numeric_value: Option<bool>,
271 #[serde(
275 rename = "exposeInternals",
276 default,
277 skip_serializing_if = "Option::is_none"
278 )]
279 pub expose_internals: Option<bool>,
280}
281
282impl crate::typed::Command for StopTrackingHeapObjectsParams {
283 const METHOD: &'static str = "HeapProfiler.stopTrackingHeapObjects";
284 type Returns = crate::typed::NoReturns;
285}
286
287#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
289pub struct TakeHeapSnapshotParams {
290 #[serde(
293 rename = "reportProgress",
294 default,
295 skip_serializing_if = "Option::is_none"
296 )]
297 pub report_progress: Option<bool>,
298 #[serde(
303 rename = "treatGlobalObjectsAsRoots",
304 default,
305 skip_serializing_if = "Option::is_none"
306 )]
307 pub treat_global_objects_as_roots: Option<bool>,
308 #[serde(
310 rename = "captureNumericValue",
311 default,
312 skip_serializing_if = "Option::is_none"
313 )]
314 pub capture_numeric_value: Option<bool>,
315 #[serde(
319 rename = "exposeInternals",
320 default,
321 skip_serializing_if = "Option::is_none"
322 )]
323 pub expose_internals: Option<bool>,
324}
325
326impl crate::typed::Command for TakeHeapSnapshotParams {
327 const METHOD: &'static str = "HeapProfiler.takeHeapSnapshot";
328 type Returns = crate::typed::NoReturns;
329}
330
331#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
333pub struct AddHeapSnapshotChunkEvent {
334 pub chunk: String,
335}
336
337impl crate::typed::Event for AddHeapSnapshotChunkEvent {
338 const METHOD: &'static str = "HeapProfiler.addHeapSnapshotChunk";
339}
340
341#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
346pub struct HeapStatsUpdateEvent {
347 #[serde(rename = "statsUpdate")]
352 pub stats_update: Vec<i64>,
353}
354
355impl crate::typed::Event for HeapStatsUpdateEvent {
356 const METHOD: &'static str = "HeapProfiler.heapStatsUpdate";
357}
358
359#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
366pub struct LastSeenObjectIdEvent {
367 #[serde(rename = "lastSeenObjectId")]
368 pub last_seen_object_id: i64,
369 pub timestamp: f64,
370}
371
372impl crate::typed::Event for LastSeenObjectIdEvent {
373 const METHOD: &'static str = "HeapProfiler.lastSeenObjectId";
374}
375
376#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
378pub struct ReportHeapSnapshotProgressEvent {
379 pub done: i64,
380 pub total: i64,
381 #[serde(default, skip_serializing_if = "Option::is_none")]
382 pub finished: Option<bool>,
383}
384
385impl crate::typed::Event for ReportHeapSnapshotProgressEvent {
386 const METHOD: &'static str = "HeapProfiler.reportHeapSnapshotProgress";
387}
388
389#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
391pub struct ResetProfilesEvent {}
392
393impl crate::typed::Event for ResetProfilesEvent {
394 const METHOD: &'static str = "HeapProfiler.resetProfiles";
395}