1use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
15pub struct ProfileNode {
16 pub id: i64,
18 #[serde(rename = "callFrame")]
20 pub call_frame: crate::protocol::runtime::CallFrame,
21 #[serde(rename = "hitCount", default, skip_serializing_if = "Option::is_none")]
23 pub hit_count: Option<i64>,
24 #[serde(default, skip_serializing_if = "Option::is_none")]
26 pub children: Option<Vec<i64>>,
27 #[serde(
30 rename = "deoptReason",
31 default,
32 skip_serializing_if = "Option::is_none"
33 )]
34 pub deopt_reason: Option<String>,
35 #[serde(
37 rename = "positionTicks",
38 default,
39 skip_serializing_if = "Option::is_none"
40 )]
41 pub position_ticks: Option<Vec<PositionTickInfo>>,
42}
43
44#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
46pub struct Profile {
47 pub nodes: Vec<ProfileNode>,
49 #[serde(rename = "startTime")]
51 pub start_time: f64,
52 #[serde(rename = "endTime")]
54 pub end_time: f64,
55 #[serde(default, skip_serializing_if = "Option::is_none")]
57 pub samples: Option<Vec<i64>>,
58 #[serde(
61 rename = "timeDeltas",
62 default,
63 skip_serializing_if = "Option::is_none"
64 )]
65 pub time_deltas: Option<Vec<i64>>,
66}
67
68#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
70pub struct PositionTickInfo {
71 pub line: i64,
73 pub ticks: i64,
75}
76
77#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
79pub struct CoverageRange {
80 #[serde(rename = "startOffset")]
82 pub start_offset: i64,
83 #[serde(rename = "endOffset")]
85 pub end_offset: i64,
86 pub count: i64,
88}
89
90#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
92pub struct FunctionCoverage {
93 #[serde(rename = "functionName")]
95 pub function_name: String,
96 pub ranges: Vec<CoverageRange>,
98 #[serde(rename = "isBlockCoverage")]
100 pub is_block_coverage: bool,
101}
102
103#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
105pub struct ScriptCoverage {
106 #[serde(rename = "scriptId")]
108 pub script_id: crate::protocol::runtime::ScriptId,
109 pub url: String,
111 pub functions: Vec<FunctionCoverage>,
113}
114
115#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
117pub struct DisableParams {}
118
119impl crate::typed::Command for DisableParams {
120 const METHOD: &'static str = "Profiler.disable";
121 type Returns = crate::typed::NoReturns;
122}
123
124#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
126pub struct EnableParams {}
127
128impl crate::typed::Command for EnableParams {
129 const METHOD: &'static str = "Profiler.enable";
130 type Returns = crate::typed::NoReturns;
131}
132
133#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
138pub struct GetBestEffortCoverageParams {}
139
140#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
142pub struct GetBestEffortCoverageReturns {
143 pub result: Vec<ScriptCoverage>,
145}
146
147impl crate::typed::Command for GetBestEffortCoverageParams {
148 const METHOD: &'static str = "Profiler.getBestEffortCoverage";
149 type Returns = GetBestEffortCoverageReturns;
150}
151
152#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
157pub struct SetSamplingIntervalParams {
158 pub interval: i64,
160}
161
162impl crate::typed::Command for SetSamplingIntervalParams {
163 const METHOD: &'static str = "Profiler.setSamplingInterval";
164 type Returns = crate::typed::NoReturns;
165}
166
167#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
169pub struct StartParams {}
170
171impl crate::typed::Command for StartParams {
172 const METHOD: &'static str = "Profiler.start";
173 type Returns = crate::typed::NoReturns;
174}
175
176#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
182pub struct StartPreciseCoverageParams {
183 #[serde(rename = "callCount", default, skip_serializing_if = "Option::is_none")]
185 pub call_count: Option<bool>,
186 #[serde(default, skip_serializing_if = "Option::is_none")]
188 pub detailed: Option<bool>,
189 #[serde(
191 rename = "allowTriggeredUpdates",
192 default,
193 skip_serializing_if = "Option::is_none"
194 )]
195 pub allow_triggered_updates: Option<bool>,
196}
197
198#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
200pub struct StartPreciseCoverageReturns {
201 pub timestamp: f64,
204}
205
206impl crate::typed::Command for StartPreciseCoverageParams {
207 const METHOD: &'static str = "Profiler.startPreciseCoverage";
208 type Returns = StartPreciseCoverageReturns;
209}
210
211#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
213pub struct StopParams {}
214
215#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
217pub struct StopReturns {
218 pub profile: Profile,
220}
221
222impl crate::typed::Command for StopParams {
223 const METHOD: &'static str = "Profiler.stop";
224 type Returns = StopReturns;
225}
226
227#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
232pub struct StopPreciseCoverageParams {}
233
234impl crate::typed::Command for StopPreciseCoverageParams {
235 const METHOD: &'static str = "Profiler.stopPreciseCoverage";
236 type Returns = crate::typed::NoReturns;
237}
238
239#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
244pub struct TakePreciseCoverageParams {}
245
246#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
248pub struct TakePreciseCoverageReturns {
249 pub result: Vec<ScriptCoverage>,
251 pub timestamp: f64,
254}
255
256impl crate::typed::Command for TakePreciseCoverageParams {
257 const METHOD: &'static str = "Profiler.takePreciseCoverage";
258 type Returns = TakePreciseCoverageReturns;
259}
260
261#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
263pub struct ConsoleProfileFinishedEvent {
264 pub id: String,
265 pub location: crate::protocol::debugger::Location,
267 pub profile: Profile,
268 #[serde(default, skip_serializing_if = "Option::is_none")]
270 pub title: Option<String>,
271}
272
273impl crate::typed::Event for ConsoleProfileFinishedEvent {
274 const METHOD: &'static str = "Profiler.consoleProfileFinished";
275}
276
277#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
281pub struct ConsoleProfileStartedEvent {
282 pub id: String,
283 pub location: crate::protocol::debugger::Location,
285 #[serde(default, skip_serializing_if = "Option::is_none")]
287 pub title: Option<String>,
288}
289
290impl crate::typed::Event for ConsoleProfileStartedEvent {
291 const METHOD: &'static str = "Profiler.consoleProfileStarted";
292}
293
294#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
304pub struct PreciseCoverageDeltaUpdateEvent {
305 pub timestamp: f64,
308 pub occasion: String,
310 pub result: Vec<ScriptCoverage>,
312}
313
314impl crate::typed::Event for PreciseCoverageDeltaUpdateEvent {
315 const METHOD: &'static str = "Profiler.preciseCoverageDeltaUpdate";
316}