Skip to main content

rustenium_cdp_definitions/js_protocol/heap_profiler/
events.rs

1use serde::{Deserialize, Serialize};
2#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3pub struct AddHeapSnapshotChunkParams {
4    #[serde(rename = "chunk")]
5    pub chunk: String,
6}
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8pub enum AddHeapSnapshotChunkMethod {
9    #[serde(rename = "HeapProfiler.addHeapSnapshotChunk")]
10    AddHeapSnapshotChunk,
11}
12#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13pub struct AddHeapSnapshotChunk {
14    pub method: AddHeapSnapshotChunkMethod,
15    pub params: AddHeapSnapshotChunkParams,
16}
17impl AddHeapSnapshotChunk {
18    pub const IDENTIFIER: &'static str = "HeapProfiler.addHeapSnapshotChunk";
19    pub fn identifier(&self) -> &'static str {
20        Self::IDENTIFIER
21    }
22}
23#[doc = "If heap objects tracking has been started then backend may send update for one or more fragments\n[heapStatsUpdate](https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler/#event-heapStatsUpdate)"]
24#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
25pub struct HeapStatsUpdateParams {
26    #[doc = "An array of triplets. Each triplet describes a fragment. The first integer is the fragment\nindex, the second integer is a total count of objects for the fragment, the third integer is\na total size of the objects for the fragment."]
27    #[serde(rename = "statsUpdate")]
28    #[serde(skip_serializing_if = "Vec::is_empty")]
29    pub stats_update: Vec<i64>,
30}
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32pub enum HeapStatsUpdateMethod {
33    #[serde(rename = "HeapProfiler.heapStatsUpdate")]
34    HeapStatsUpdate,
35}
36#[doc = "If heap objects tracking has been started then backend may send update for one or more fragments\n[heapStatsUpdate](https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler/#event-heapStatsUpdate)"]
37#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
38pub struct HeapStatsUpdate {
39    pub method: HeapStatsUpdateMethod,
40    pub params: HeapStatsUpdateParams,
41}
42impl HeapStatsUpdate {
43    pub const IDENTIFIER: &'static str = "HeapProfiler.heapStatsUpdate";
44    pub fn identifier(&self) -> &'static str {
45        Self::IDENTIFIER
46    }
47}
48#[doc = "If heap objects tracking has been started then backend regularly sends a current value for last\nseen object id and corresponding timestamp. If the were changes in the heap since last event\nthen one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.\n[lastSeenObjectId](https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler/#event-lastSeenObjectId)"]
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
50pub struct LastSeenObjectIdParams {
51    #[serde(rename = "lastSeenObjectId")]
52    pub last_seen_object_id: i64,
53    #[serde(rename = "timestamp")]
54    pub timestamp: f64,
55}
56#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
57pub enum LastSeenObjectIdMethod {
58    #[serde(rename = "HeapProfiler.lastSeenObjectId")]
59    LastSeenObjectId,
60}
61#[doc = "If heap objects tracking has been started then backend regularly sends a current value for last\nseen object id and corresponding timestamp. If the were changes in the heap since last event\nthen one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.\n[lastSeenObjectId](https://chromedevtools.github.io/devtools-protocol/tot/HeapProfiler/#event-lastSeenObjectId)"]
62#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
63pub struct LastSeenObjectId {
64    pub method: LastSeenObjectIdMethod,
65    pub params: LastSeenObjectIdParams,
66}
67impl LastSeenObjectId {
68    pub const IDENTIFIER: &'static str = "HeapProfiler.lastSeenObjectId";
69    pub fn identifier(&self) -> &'static str {
70        Self::IDENTIFIER
71    }
72}
73#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
74pub struct ReportHeapSnapshotProgressParams {
75    #[serde(rename = "done")]
76    pub done: i64,
77    #[serde(rename = "total")]
78    pub total: i64,
79    #[serde(rename = "finished")]
80    #[serde(skip_serializing_if = "Option::is_none")]
81    #[serde(default)]
82    pub finished: Option<bool>,
83}
84#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
85pub enum ReportHeapSnapshotProgressMethod {
86    #[serde(rename = "HeapProfiler.reportHeapSnapshotProgress")]
87    ReportHeapSnapshotProgress,
88}
89#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
90pub struct ReportHeapSnapshotProgress {
91    pub method: ReportHeapSnapshotProgressMethod,
92    pub params: ReportHeapSnapshotProgressParams,
93}
94impl ReportHeapSnapshotProgress {
95    pub const IDENTIFIER: &'static str = "HeapProfiler.reportHeapSnapshotProgress";
96    pub fn identifier(&self) -> &'static str {
97        Self::IDENTIFIER
98    }
99}
100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
101pub struct ResetProfilesParams {}
102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
103pub enum ResetProfilesMethod {
104    #[serde(rename = "HeapProfiler.resetProfiles")]
105    ResetProfiles,
106}
107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
108pub struct ResetProfiles {
109    pub method: ResetProfilesMethod,
110    pub params: ResetProfilesParams,
111}
112impl ResetProfiles {
113    pub const IDENTIFIER: &'static str = "HeapProfiler.resetProfiles";
114    pub fn identifier(&self) -> &'static str {
115        Self::IDENTIFIER
116    }
117}
118group_enum ! (HeapProfilerEvents { AddHeapSnapshotChunk (AddHeapSnapshotChunk) , HeapStatsUpdate (HeapStatsUpdate) , LastSeenObjectId (LastSeenObjectId) , ReportHeapSnapshotProgress (ReportHeapSnapshotProgress) , ResetProfiles (ResetProfiles) } + identifiable);