Skip to main content

rustenium_cdp_definitions/browser_protocol/tracing/
commands.rs

1use serde::{Deserialize, Serialize};
2#[doc = "Stop trace events collection.\n[end](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-end)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct EndParams {}
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub enum EndMethod {
7    #[serde(rename = "Tracing.end")]
8    End,
9}
10#[doc = "Stop trace events collection.\n[end](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-end)"]
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12pub struct End {
13    pub method: EndMethod,
14    pub params: EndParams,
15}
16impl End {
17    pub const IDENTIFIER: &'static str = "Tracing.end";
18    pub fn identifier(&self) -> &'static str {
19        Self::IDENTIFIER
20    }
21}
22impl crate::CommandResult for End {
23    type Result = super::results::EndResult;
24}
25#[doc = "Gets supported tracing categories.\n[getCategories](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-getCategories)"]
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct GetCategoriesParams {}
28#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
29pub enum GetCategoriesMethod {
30    #[serde(rename = "Tracing.getCategories")]
31    GetCategories,
32}
33#[doc = "Gets supported tracing categories.\n[getCategories](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-getCategories)"]
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct GetCategories {
36    pub method: GetCategoriesMethod,
37    pub params: GetCategoriesParams,
38}
39impl GetCategories {
40    pub const IDENTIFIER: &'static str = "Tracing.getCategories";
41    pub fn identifier(&self) -> &'static str {
42        Self::IDENTIFIER
43    }
44}
45impl crate::CommandResult for GetCategories {
46    type Result = super::results::GetCategoriesResult;
47}
48#[doc = "Return a descriptor for all available tracing categories.\n[getTrackEventDescriptor](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-getTrackEventDescriptor)"]
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
50pub struct GetTrackEventDescriptorParams {}
51#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
52pub enum GetTrackEventDescriptorMethod {
53    #[serde(rename = "Tracing.getTrackEventDescriptor")]
54    GetTrackEventDescriptor,
55}
56#[doc = "Return a descriptor for all available tracing categories.\n[getTrackEventDescriptor](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-getTrackEventDescriptor)"]
57#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
58pub struct GetTrackEventDescriptor {
59    pub method: GetTrackEventDescriptorMethod,
60    pub params: GetTrackEventDescriptorParams,
61}
62impl GetTrackEventDescriptor {
63    pub const IDENTIFIER: &'static str = "Tracing.getTrackEventDescriptor";
64    pub fn identifier(&self) -> &'static str {
65        Self::IDENTIFIER
66    }
67}
68impl crate::CommandResult for GetTrackEventDescriptor {
69    type Result = super::results::GetTrackEventDescriptorResult;
70}
71#[doc = "Record a clock sync marker in the trace.\n[recordClockSyncMarker](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-recordClockSyncMarker)"]
72#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
73pub struct RecordClockSyncMarkerParams {
74    #[doc = "The ID of this clock sync marker"]
75    #[serde(rename = "syncId")]
76    pub sync_id: String,
77}
78impl RecordClockSyncMarkerParams {
79    pub fn new(sync_id: impl Into<String>) -> Self {
80        Self {
81            sync_id: sync_id.into(),
82        }
83    }
84}
85impl<T: Into<String>> From<T> for RecordClockSyncMarkerParams {
86    fn from(url: T) -> Self {
87        RecordClockSyncMarkerParams::new(url)
88    }
89}
90#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
91pub enum RecordClockSyncMarkerMethod {
92    #[serde(rename = "Tracing.recordClockSyncMarker")]
93    RecordClockSyncMarker,
94}
95#[doc = "Record a clock sync marker in the trace.\n[recordClockSyncMarker](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-recordClockSyncMarker)"]
96#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
97pub struct RecordClockSyncMarker {
98    pub method: RecordClockSyncMarkerMethod,
99    pub params: RecordClockSyncMarkerParams,
100}
101impl RecordClockSyncMarker {
102    pub const IDENTIFIER: &'static str = "Tracing.recordClockSyncMarker";
103    pub fn identifier(&self) -> &'static str {
104        Self::IDENTIFIER
105    }
106}
107impl crate::CommandResult for RecordClockSyncMarker {
108    type Result = super::results::RecordClockSyncMarkerResult;
109}
110#[doc = "Request a global memory dump.\n[requestMemoryDump](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-requestMemoryDump)"]
111#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
112pub struct RequestMemoryDumpParams {
113    #[doc = "Enables more deterministic results by forcing garbage collection"]
114    #[serde(rename = "deterministic")]
115    #[serde(skip_serializing_if = "Option::is_none")]
116    #[serde(default)]
117    pub deterministic: Option<bool>,
118    #[doc = "Specifies level of details in memory dump. Defaults to \"detailed\"."]
119    #[serde(rename = "levelOfDetail")]
120    #[serde(skip_serializing_if = "Option::is_none")]
121    #[serde(default)]
122    pub level_of_detail: Option<super::types::MemoryDumpLevelOfDetail>,
123}
124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
125pub enum RequestMemoryDumpMethod {
126    #[serde(rename = "Tracing.requestMemoryDump")]
127    RequestMemoryDump,
128}
129#[doc = "Request a global memory dump.\n[requestMemoryDump](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-requestMemoryDump)"]
130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
131pub struct RequestMemoryDump {
132    pub method: RequestMemoryDumpMethod,
133    pub params: RequestMemoryDumpParams,
134}
135impl RequestMemoryDump {
136    pub const IDENTIFIER: &'static str = "Tracing.requestMemoryDump";
137    pub fn identifier(&self) -> &'static str {
138        Self::IDENTIFIER
139    }
140}
141impl crate::CommandResult for RequestMemoryDump {
142    type Result = super::results::RequestMemoryDumpResult;
143}
144#[doc = "Start trace events collection.\n[start](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-start)"]
145#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
146pub struct StartParams {
147    #[doc = "If set, the agent will issue bufferUsage events at this interval, specified in milliseconds"]
148    #[serde(rename = "bufferUsageReportingInterval")]
149    #[serde(skip_serializing_if = "Option::is_none")]
150    #[serde(default)]
151    pub buffer_usage_reporting_interval: Option<f64>,
152    #[doc = "Whether to report trace events as series of dataCollected events or to save trace to a\nstream (defaults to `ReportEvents`)."]
153    #[serde(rename = "transferMode")]
154    #[serde(skip_serializing_if = "Option::is_none")]
155    #[serde(default)]
156    pub transfer_mode: Option<StartTransferMode>,
157    #[doc = "Trace data format to use. This only applies when using `ReturnAsStream`\ntransfer mode (defaults to `json`)."]
158    #[serde(rename = "streamFormat")]
159    #[serde(skip_serializing_if = "Option::is_none")]
160    #[serde(default)]
161    pub stream_format: Option<super::types::StreamFormat>,
162    #[doc = "Compression format to use. This only applies when using `ReturnAsStream`\ntransfer mode (defaults to `none`)"]
163    #[serde(rename = "streamCompression")]
164    #[serde(skip_serializing_if = "Option::is_none")]
165    #[serde(default)]
166    pub stream_compression: Option<super::types::StreamCompression>,
167    #[serde(rename = "traceConfig")]
168    #[serde(skip_serializing_if = "Option::is_none")]
169    #[serde(default)]
170    pub trace_config: Option<super::types::TraceConfig>,
171    #[doc = "Base64-encoded serialized perfetto.protos.TraceConfig protobuf message\nWhen specified, the parameters `categories`, `options`, `traceConfig`\nare ignored."]
172    #[serde(rename = "perfettoConfig")]
173    #[serde(skip_serializing_if = "Option::is_none")]
174    #[serde(default)]
175    pub perfetto_config: Option<crate::Binary>,
176    #[doc = "Backend type (defaults to `auto`)"]
177    #[serde(rename = "tracingBackend")]
178    #[serde(skip_serializing_if = "Option::is_none")]
179    #[serde(default)]
180    pub tracing_backend: Option<super::types::TracingBackend>,
181}
182#[doc = "Whether to report trace events as series of dataCollected events or to save trace to a\nstream (defaults to `ReportEvents`)."]
183#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
184pub enum StartTransferMode {
185    #[serde(rename = "ReportEvents")]
186    ReportEvents,
187    #[serde(rename = "ReturnAsStream")]
188    ReturnAsStream,
189}
190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
191pub enum StartMethod {
192    #[serde(rename = "Tracing.start")]
193    Start,
194}
195#[doc = "Start trace events collection.\n[start](https://chromedevtools.github.io/devtools-protocol/tot/Tracing/#method-start)"]
196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
197pub struct Start {
198    pub method: StartMethod,
199    pub params: StartParams,
200}
201impl Start {
202    pub const IDENTIFIER: &'static str = "Tracing.start";
203    pub fn identifier(&self) -> &'static str {
204        Self::IDENTIFIER
205    }
206}
207impl crate::CommandResult for Start {
208    type Result = super::results::StartResult;
209}
210group_enum ! (TracingCommands { End (End) , GetCategories (GetCategories) , GetTrackEventDescriptor (GetTrackEventDescriptor) , RecordClockSyncMarker (RecordClockSyncMarker) , RequestMemoryDump (RequestMemoryDump) , Start (Start) } + identifiable);