Skip to main content

cdp_protocol/
heap_profiler.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: HeapProfiler
2#![allow(dead_code)]
3use super::runtime;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use derive_builder::Builder;
8#[allow(unused_imports)]
9use serde::{Deserialize, Serialize};
10#[allow(unused_imports)]
11use serde_json::Value as Json;
12pub type HeapSnapshotObjectId = String;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
15#[builder(setter(into, strip_option))]
16#[serde(rename_all = "camelCase")]
17#[doc = "Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes."]
18pub struct SamplingHeapProfileNode {
19    #[doc = "Function location."]
20    pub call_frame: runtime::CallFrame,
21    #[serde(default)]
22    #[doc = "Allocations size in bytes for the node excluding children."]
23    pub self_size: JsFloat,
24    #[serde(default)]
25    #[doc = "Node id. Ids are unique across all profiles collected between startSampling and stopSampling."]
26    pub id: JsUInt,
27    #[doc = "Child nodes."]
28    pub children: Vec<SamplingHeapProfileNode>,
29}
30#[allow(deprecated)]
31#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
32#[builder(setter(into, strip_option))]
33#[serde(rename_all = "camelCase")]
34#[doc = "A single sample from a sampling profile."]
35pub struct SamplingHeapProfileSample {
36    #[serde(default)]
37    #[doc = "Allocation size in bytes attributed to the sample."]
38    pub size: JsFloat,
39    #[serde(default)]
40    #[doc = "Id of the corresponding profile tree node."]
41    pub node_id: JsUInt,
42    #[serde(default)]
43    #[doc = "Time-ordered sample ordinal number. It is unique across all profiles retrieved\n between startSampling and stopSampling."]
44    pub ordinal: JsFloat,
45}
46#[allow(deprecated)]
47#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
48#[builder(setter(into, strip_option))]
49#[serde(rename_all = "camelCase")]
50#[doc = "Sampling profile."]
51pub struct SamplingHeapProfile {
52    pub head: SamplingHeapProfileNode,
53    pub samples: Vec<SamplingHeapProfileSample>,
54}
55#[allow(deprecated)]
56#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
57#[builder(setter(into, strip_option))]
58#[serde(rename_all = "camelCase")]
59#[doc = "Enables console to refer to the node with given id via $x (see Command Line API for more details\n $x functions)."]
60pub struct AddInspectedHeapObject {
61    #[doc = "Heap snapshot object id to be accessible by means of $x command line API."]
62    pub heap_object_id: HeapSnapshotObjectId,
63}
64#[allow(deprecated)]
65#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
66pub struct CollectGarbage(pub Option<Json>);
67#[allow(deprecated)]
68#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
69pub struct Disable(pub Option<Json>);
70#[allow(deprecated)]
71#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
72pub struct Enable(pub Option<Json>);
73#[allow(deprecated)]
74#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
75#[builder(setter(into, strip_option))]
76#[serde(rename_all = "camelCase")]
77pub struct GetHeapObjectId {
78    #[doc = "Identifier of the object to get heap object id for."]
79    pub object_id: runtime::RemoteObjectId,
80}
81#[allow(deprecated)]
82#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
83#[builder(setter(into, strip_option))]
84#[serde(rename_all = "camelCase")]
85pub struct GetObjectByHeapObjectId {
86    pub object_id: HeapSnapshotObjectId,
87    #[builder(default)]
88    #[serde(skip_serializing_if = "Option::is_none")]
89    #[serde(default)]
90    #[doc = "Symbolic group name that can be used to release multiple objects."]
91    pub object_group: Option<String>,
92}
93#[allow(deprecated)]
94#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
95pub struct GetSamplingProfile(pub Option<Json>);
96#[allow(deprecated)]
97#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
98#[builder(setter(into, strip_option))]
99#[serde(rename_all = "camelCase")]
100pub struct StartSampling {
101    #[builder(default)]
102    #[serde(skip_serializing_if = "Option::is_none")]
103    #[serde(default)]
104    #[doc = "Average sample interval in bytes. Poisson distribution is used for the intervals. The\n default value is 32768 bytes."]
105    pub sampling_interval: Option<JsFloat>,
106    #[builder(default)]
107    #[serde(skip_serializing_if = "Option::is_none")]
108    #[serde(default)]
109    #[doc = "Maximum stack depth. The default value is 128."]
110    pub stack_depth: Option<JsFloat>,
111    #[builder(default)]
112    #[serde(skip_serializing_if = "Option::is_none")]
113    #[serde(default)]
114    #[doc = "By default, the sampling heap profiler reports only objects which are\n still alive when the profile is returned via getSamplingProfile or\n stopSampling, which is useful for determining what functions contribute\n the most to steady-state memory usage. This flag instructs the sampling\n heap profiler to also include information about objects discarded by\n major GC, which will show which functions cause large temporary memory\n usage or long GC pauses."]
115    #[serde(rename = "includeObjectsCollectedByMajorGC")]
116    pub include_objects_collected_by_major_gc: Option<bool>,
117    #[builder(default)]
118    #[serde(skip_serializing_if = "Option::is_none")]
119    #[serde(default)]
120    #[doc = "By default, the sampling heap profiler reports only objects which are\n still alive when the profile is returned via getSamplingProfile or\n stopSampling, which is useful for determining what functions contribute\n the most to steady-state memory usage. This flag instructs the sampling\n heap profiler to also include information about objects discarded by\n minor GC, which is useful when tuning a latency-sensitive application\n for minimal GC activity."]
121    #[serde(rename = "includeObjectsCollectedByMinorGC")]
122    pub include_objects_collected_by_minor_gc: Option<bool>,
123}
124#[allow(deprecated)]
125#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
126#[builder(setter(into, strip_option))]
127#[serde(rename_all = "camelCase")]
128pub struct StartTrackingHeapObjects {
129    #[builder(default)]
130    #[serde(skip_serializing_if = "Option::is_none")]
131    #[serde(default)]
132    pub track_allocations: Option<bool>,
133}
134#[allow(deprecated)]
135#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
136pub struct StopSampling(pub Option<Json>);
137#[allow(deprecated)]
138#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
139#[builder(setter(into, strip_option))]
140#[serde(rename_all = "camelCase")]
141pub struct StopTrackingHeapObjects {
142    #[builder(default)]
143    #[serde(skip_serializing_if = "Option::is_none")]
144    #[serde(default)]
145    #[doc = "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken\n when the tracking is stopped."]
146    pub report_progress: Option<bool>,
147    #[builder(default)]
148    #[serde(skip_serializing_if = "Option::is_none")]
149    #[serde(default)]
150    #[doc = "Deprecated in favor of `exposeInternals`."]
151    #[deprecated]
152    pub treat_global_objects_as_roots: Option<bool>,
153    #[builder(default)]
154    #[serde(skip_serializing_if = "Option::is_none")]
155    #[serde(default)]
156    #[doc = "If true, numerical values are included in the snapshot"]
157    pub capture_numeric_value: Option<bool>,
158    #[builder(default)]
159    #[serde(skip_serializing_if = "Option::is_none")]
160    #[serde(default)]
161    #[doc = "If true, exposes internals of the snapshot."]
162    pub expose_internals: Option<bool>,
163}
164#[allow(deprecated)]
165#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
166#[builder(setter(into, strip_option))]
167#[serde(rename_all = "camelCase")]
168pub struct TakeHeapSnapshot {
169    #[builder(default)]
170    #[serde(skip_serializing_if = "Option::is_none")]
171    #[serde(default)]
172    #[doc = "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken."]
173    pub report_progress: Option<bool>,
174    #[builder(default)]
175    #[serde(skip_serializing_if = "Option::is_none")]
176    #[serde(default)]
177    #[doc = "If true, a raw snapshot without artificial roots will be generated.\n Deprecated in favor of `exposeInternals`."]
178    #[deprecated]
179    pub treat_global_objects_as_roots: Option<bool>,
180    #[builder(default)]
181    #[serde(skip_serializing_if = "Option::is_none")]
182    #[serde(default)]
183    #[doc = "If true, numerical values are included in the snapshot"]
184    pub capture_numeric_value: Option<bool>,
185    #[builder(default)]
186    #[serde(skip_serializing_if = "Option::is_none")]
187    #[serde(default)]
188    #[doc = "If true, exposes internals of the snapshot."]
189    pub expose_internals: Option<bool>,
190}
191#[allow(deprecated)]
192#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
193#[doc = "Enables console to refer to the node with given id via $x (see Command Line API for more details\n $x functions)."]
194pub struct AddInspectedHeapObjectReturnObject(pub Option<Json>);
195#[allow(deprecated)]
196#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
197pub struct CollectGarbageReturnObject(pub Option<Json>);
198#[allow(deprecated)]
199#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
200pub struct DisableReturnObject(pub Option<Json>);
201#[allow(deprecated)]
202#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
203pub struct EnableReturnObject(pub Option<Json>);
204#[allow(deprecated)]
205#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
206#[serde(rename_all = "camelCase")]
207pub struct GetHeapObjectIdReturnObject {
208    #[doc = "Id of the heap snapshot object corresponding to the passed remote object id."]
209    pub heap_snapshot_object_id: HeapSnapshotObjectId,
210}
211#[allow(deprecated)]
212#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
213#[serde(rename_all = "camelCase")]
214pub struct GetObjectByHeapObjectIdReturnObject {
215    #[doc = "Evaluation result."]
216    pub result: runtime::RemoteObject,
217}
218#[allow(deprecated)]
219#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
220#[serde(rename_all = "camelCase")]
221pub struct GetSamplingProfileReturnObject {
222    #[doc = "Return the sampling profile being collected."]
223    pub profile: SamplingHeapProfile,
224}
225#[allow(deprecated)]
226#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
227pub struct StartSamplingReturnObject(pub Option<Json>);
228#[allow(deprecated)]
229#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
230pub struct StartTrackingHeapObjectsReturnObject(pub Option<Json>);
231#[allow(deprecated)]
232#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
233#[serde(rename_all = "camelCase")]
234pub struct StopSamplingReturnObject {
235    #[doc = "Recorded sampling heap profile."]
236    pub profile: SamplingHeapProfile,
237}
238#[allow(deprecated)]
239#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
240pub struct StopTrackingHeapObjectsReturnObject(pub Option<Json>);
241#[allow(deprecated)]
242#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
243pub struct TakeHeapSnapshotReturnObject(pub Option<Json>);
244#[allow(deprecated)]
245impl Method for AddInspectedHeapObject {
246    const NAME: &'static str = "HeapProfiler.addInspectedHeapObject";
247    type ReturnObject = AddInspectedHeapObjectReturnObject;
248}
249#[allow(deprecated)]
250impl Method for CollectGarbage {
251    const NAME: &'static str = "HeapProfiler.collectGarbage";
252    type ReturnObject = CollectGarbageReturnObject;
253}
254#[allow(deprecated)]
255impl Method for Disable {
256    const NAME: &'static str = "HeapProfiler.disable";
257    type ReturnObject = DisableReturnObject;
258}
259#[allow(deprecated)]
260impl Method for Enable {
261    const NAME: &'static str = "HeapProfiler.enable";
262    type ReturnObject = EnableReturnObject;
263}
264#[allow(deprecated)]
265impl Method for GetHeapObjectId {
266    const NAME: &'static str = "HeapProfiler.getHeapObjectId";
267    type ReturnObject = GetHeapObjectIdReturnObject;
268}
269#[allow(deprecated)]
270impl Method for GetObjectByHeapObjectId {
271    const NAME: &'static str = "HeapProfiler.getObjectByHeapObjectId";
272    type ReturnObject = GetObjectByHeapObjectIdReturnObject;
273}
274#[allow(deprecated)]
275impl Method for GetSamplingProfile {
276    const NAME: &'static str = "HeapProfiler.getSamplingProfile";
277    type ReturnObject = GetSamplingProfileReturnObject;
278}
279#[allow(deprecated)]
280impl Method for StartSampling {
281    const NAME: &'static str = "HeapProfiler.startSampling";
282    type ReturnObject = StartSamplingReturnObject;
283}
284#[allow(deprecated)]
285impl Method for StartTrackingHeapObjects {
286    const NAME: &'static str = "HeapProfiler.startTrackingHeapObjects";
287    type ReturnObject = StartTrackingHeapObjectsReturnObject;
288}
289#[allow(deprecated)]
290impl Method for StopSampling {
291    const NAME: &'static str = "HeapProfiler.stopSampling";
292    type ReturnObject = StopSamplingReturnObject;
293}
294#[allow(deprecated)]
295impl Method for StopTrackingHeapObjects {
296    const NAME: &'static str = "HeapProfiler.stopTrackingHeapObjects";
297    type ReturnObject = StopTrackingHeapObjectsReturnObject;
298}
299#[allow(deprecated)]
300impl Method for TakeHeapSnapshot {
301    const NAME: &'static str = "HeapProfiler.takeHeapSnapshot";
302    type ReturnObject = TakeHeapSnapshotReturnObject;
303}
304#[allow(dead_code)]
305pub mod events {
306    #[allow(unused_imports)]
307    use super::super::types::*;
308    #[allow(unused_imports)]
309    use derive_builder::Builder;
310    #[allow(unused_imports)]
311    use serde::{Deserialize, Serialize};
312    #[allow(unused_imports)]
313    use serde_json::Value as Json;
314    #[allow(deprecated)]
315    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
316    pub struct AddHeapSnapshotChunkEvent {
317        pub params: AddHeapSnapshotChunkEventParams,
318    }
319    #[allow(deprecated)]
320    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
321    #[serde(rename_all = "camelCase")]
322    pub struct AddHeapSnapshotChunkEventParams {
323        #[serde(default)]
324        pub chunk: String,
325    }
326    #[allow(deprecated)]
327    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
328    pub struct HeapStatsUpdateEvent {
329        pub params: HeapStatsUpdateEventParams,
330    }
331    #[allow(deprecated)]
332    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
333    #[serde(rename_all = "camelCase")]
334    pub struct HeapStatsUpdateEventParams {
335        #[serde(default)]
336        #[doc = "An array of triplets. Each triplet describes a fragment. The first integer is the fragment\n index, the second integer is a total count of objects for the fragment, the third integer is\n a total size of the objects for the fragment."]
337        pub stats_update: Vec<JsUInt>,
338    }
339    #[allow(deprecated)]
340    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
341    pub struct LastSeenObjectIdEvent {
342        pub params: LastSeenObjectIdEventParams,
343    }
344    #[allow(deprecated)]
345    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
346    #[serde(rename_all = "camelCase")]
347    pub struct LastSeenObjectIdEventParams {
348        #[serde(default)]
349        pub last_seen_object_id: JsUInt,
350        #[serde(default)]
351        pub timestamp: JsFloat,
352    }
353    #[allow(deprecated)]
354    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
355    pub struct ReportHeapSnapshotProgressEvent {
356        pub params: ReportHeapSnapshotProgressEventParams,
357    }
358    #[allow(deprecated)]
359    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
360    #[serde(rename_all = "camelCase")]
361    pub struct ReportHeapSnapshotProgressEventParams {
362        #[serde(default)]
363        pub done: JsUInt,
364        #[serde(default)]
365        pub total: JsUInt,
366        #[builder(default)]
367        #[serde(skip_serializing_if = "Option::is_none")]
368        #[serde(default)]
369        pub finished: Option<bool>,
370    }
371    #[allow(deprecated)]
372    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
373    pub struct ResetProfilesEvent(pub Option<Json>);
374}