1#![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;
12#[allow(deprecated)]
13#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
14#[builder(setter(into, strip_option))]
15#[serde(rename_all = "camelCase")]
16#[doc = "Profile node. Holds callsite information, execution statistics and child nodes."]
17pub struct ProfileNode {
18 #[serde(default)]
19 #[doc = "Unique id of the node."]
20 pub id: JsUInt,
21 #[doc = "Function location."]
22 pub call_frame: runtime::CallFrame,
23 #[builder(default)]
24 #[serde(skip_serializing_if = "Option::is_none")]
25 #[serde(default)]
26 #[doc = "Number of samples where this node was on top of the call stack."]
27 pub hit_count: Option<JsUInt>,
28 #[builder(default)]
29 #[serde(skip_serializing_if = "Option::is_none")]
30 #[serde(default)]
31 #[doc = "Child node ids."]
32 pub children: Option<Vec<JsUInt>>,
33 #[builder(default)]
34 #[serde(skip_serializing_if = "Option::is_none")]
35 #[serde(default)]
36 #[doc = "The reason of being not optimized. The function may be deoptimized or marked as don't\n optimize."]
37 pub deopt_reason: Option<String>,
38 #[builder(default)]
39 #[serde(skip_serializing_if = "Option::is_none")]
40 #[doc = "An array of source position ticks."]
41 pub position_ticks: Option<Vec<PositionTickInfo>>,
42}
43#[allow(deprecated)]
44#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
45#[builder(setter(into, strip_option))]
46#[serde(rename_all = "camelCase")]
47#[doc = "Profile."]
48pub struct Profile {
49 #[doc = "The list of profile nodes. First item is the root node."]
50 pub nodes: Vec<ProfileNode>,
51 #[serde(default)]
52 #[doc = "Profiling start timestamp in microseconds."]
53 pub start_time: JsFloat,
54 #[serde(default)]
55 #[doc = "Profiling end timestamp in microseconds."]
56 pub end_time: JsFloat,
57 #[builder(default)]
58 #[serde(skip_serializing_if = "Option::is_none")]
59 #[serde(default)]
60 #[doc = "Ids of samples top nodes."]
61 pub samples: Option<Vec<JsUInt>>,
62 #[builder(default)]
63 #[serde(skip_serializing_if = "Option::is_none")]
64 #[serde(default)]
65 #[doc = "Time intervals between adjacent samples in microseconds. The first delta is relative to the\n profile startTime."]
66 pub time_deltas: Option<Vec<JsUInt>>,
67}
68#[allow(deprecated)]
69#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
70#[builder(setter(into, strip_option))]
71#[serde(rename_all = "camelCase")]
72#[doc = "Specifies a number of samples attributed to a certain source position."]
73pub struct PositionTickInfo {
74 #[serde(default)]
75 #[doc = "Source line number (1-based)."]
76 pub line: JsUInt,
77 #[serde(default)]
78 #[doc = "Number of samples attributed to the source line."]
79 pub ticks: JsUInt,
80}
81#[allow(deprecated)]
82#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
83#[builder(setter(into, strip_option))]
84#[serde(rename_all = "camelCase")]
85#[doc = "Coverage data for a source range."]
86pub struct CoverageRange {
87 #[serde(default)]
88 #[doc = "JavaScript script source offset for the range start."]
89 pub start_offset: JsUInt,
90 #[serde(default)]
91 #[doc = "JavaScript script source offset for the range end."]
92 pub end_offset: JsUInt,
93 #[serde(default)]
94 #[doc = "Collected execution count of the source range."]
95 pub count: JsUInt,
96}
97#[allow(deprecated)]
98#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
99#[builder(setter(into, strip_option))]
100#[serde(rename_all = "camelCase")]
101#[doc = "Coverage data for a JavaScript function."]
102pub struct FunctionCoverage {
103 #[serde(default)]
104 #[doc = "JavaScript function name."]
105 pub function_name: String,
106 #[doc = "Source ranges inside the function with coverage data."]
107 pub ranges: Vec<CoverageRange>,
108 #[serde(default)]
109 #[doc = "Whether coverage data for this function has block granularity."]
110 pub is_block_coverage: bool,
111}
112#[allow(deprecated)]
113#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
114#[builder(setter(into, strip_option))]
115#[serde(rename_all = "camelCase")]
116#[doc = "Coverage data for a JavaScript script."]
117pub struct ScriptCoverage {
118 #[doc = "JavaScript script id."]
119 pub script_id: runtime::ScriptId,
120 #[serde(default)]
121 #[doc = "JavaScript script name or url."]
122 pub url: String,
123 #[doc = "Functions contained in the script that has coverage data."]
124 pub functions: Vec<FunctionCoverage>,
125}
126#[allow(deprecated)]
127#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
128pub struct Disable(pub Option<Json>);
129#[allow(deprecated)]
130#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
131pub struct Enable(pub Option<Json>);
132#[allow(deprecated)]
133#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
134pub struct GetBestEffortCoverage(pub Option<Json>);
135#[allow(deprecated)]
136#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
137#[builder(setter(into, strip_option))]
138#[serde(rename_all = "camelCase")]
139#[doc = "Changes CPU profiler sampling interval. Must be called before CPU profiles recording started."]
140pub struct SetSamplingInterval {
141 #[serde(default)]
142 #[doc = "New sampling interval in microseconds."]
143 pub interval: JsUInt,
144}
145#[allow(deprecated)]
146#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
147pub struct Start(pub Option<Json>);
148#[allow(deprecated)]
149#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
150#[builder(setter(into, strip_option))]
151#[serde(rename_all = "camelCase")]
152#[doc = "Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code\n coverage may be incomplete. Enabling prevents running optimized code and resets execution\n counters."]
153pub struct StartPreciseCoverage {
154 #[builder(default)]
155 #[serde(skip_serializing_if = "Option::is_none")]
156 #[serde(default)]
157 #[doc = "Collect accurate call counts beyond simple 'covered' or 'not covered'."]
158 pub call_count: Option<bool>,
159 #[builder(default)]
160 #[serde(skip_serializing_if = "Option::is_none")]
161 #[serde(default)]
162 #[doc = "Collect block-based coverage."]
163 pub detailed: Option<bool>,
164 #[builder(default)]
165 #[serde(skip_serializing_if = "Option::is_none")]
166 #[serde(default)]
167 #[doc = "Allow the backend to send updates on its own initiative"]
168 pub allow_triggered_updates: Option<bool>,
169}
170#[allow(deprecated)]
171#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
172pub struct Stop(pub Option<Json>);
173#[allow(deprecated)]
174#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
175pub struct StopPreciseCoverage(pub Option<Json>);
176#[allow(deprecated)]
177#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
178pub struct TakePreciseCoverage(pub Option<Json>);
179#[allow(deprecated)]
180#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
181pub struct DisableReturnObject(pub Option<Json>);
182#[allow(deprecated)]
183#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
184pub struct EnableReturnObject(pub Option<Json>);
185#[allow(deprecated)]
186#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
187#[serde(rename_all = "camelCase")]
188#[doc = "Collect coverage data for the current isolate. The coverage data may be incomplete due to\n garbage collection."]
189pub struct GetBestEffortCoverageReturnObject {
190 #[doc = "Coverage data for the current isolate."]
191 pub result: Vec<ScriptCoverage>,
192}
193#[allow(deprecated)]
194#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
195#[doc = "Changes CPU profiler sampling interval. Must be called before CPU profiles recording started."]
196pub struct SetSamplingIntervalReturnObject(pub Option<Json>);
197#[allow(deprecated)]
198#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
199pub struct StartReturnObject(pub Option<Json>);
200#[allow(deprecated)]
201#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
202#[serde(rename_all = "camelCase")]
203#[doc = "Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code\n coverage may be incomplete. Enabling prevents running optimized code and resets execution\n counters."]
204pub struct StartPreciseCoverageReturnObject {
205 #[serde(default)]
206 #[doc = "Monotonically increasing time (in seconds) when the coverage update was taken in the backend."]
207 pub timestamp: JsFloat,
208}
209#[allow(deprecated)]
210#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
211#[serde(rename_all = "camelCase")]
212pub struct StopReturnObject {
213 #[doc = "Recorded profile."]
214 pub profile: Profile,
215}
216#[allow(deprecated)]
217#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
218#[doc = "Disable precise code coverage. Disabling releases unnecessary execution count records and allows\n executing optimized code."]
219pub struct StopPreciseCoverageReturnObject(pub Option<Json>);
220#[allow(deprecated)]
221#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
222#[serde(rename_all = "camelCase")]
223#[doc = "Collect coverage data for the current isolate, and resets execution counters. Precise code\n coverage needs to have started."]
224pub struct TakePreciseCoverageReturnObject {
225 #[doc = "Coverage data for the current isolate."]
226 pub result: Vec<ScriptCoverage>,
227 #[serde(default)]
228 #[doc = "Monotonically increasing time (in seconds) when the coverage update was taken in the backend."]
229 pub timestamp: JsFloat,
230}
231#[allow(deprecated)]
232impl Method for Disable {
233 const NAME: &'static str = "Profiler.disable";
234 type ReturnObject = DisableReturnObject;
235}
236#[allow(deprecated)]
237impl Method for Enable {
238 const NAME: &'static str = "Profiler.enable";
239 type ReturnObject = EnableReturnObject;
240}
241#[allow(deprecated)]
242impl Method for GetBestEffortCoverage {
243 const NAME: &'static str = "Profiler.getBestEffortCoverage";
244 type ReturnObject = GetBestEffortCoverageReturnObject;
245}
246#[allow(deprecated)]
247impl Method for SetSamplingInterval {
248 const NAME: &'static str = "Profiler.setSamplingInterval";
249 type ReturnObject = SetSamplingIntervalReturnObject;
250}
251#[allow(deprecated)]
252impl Method for Start {
253 const NAME: &'static str = "Profiler.start";
254 type ReturnObject = StartReturnObject;
255}
256#[allow(deprecated)]
257impl Method for StartPreciseCoverage {
258 const NAME: &'static str = "Profiler.startPreciseCoverage";
259 type ReturnObject = StartPreciseCoverageReturnObject;
260}
261#[allow(deprecated)]
262impl Method for Stop {
263 const NAME: &'static str = "Profiler.stop";
264 type ReturnObject = StopReturnObject;
265}
266#[allow(deprecated)]
267impl Method for StopPreciseCoverage {
268 const NAME: &'static str = "Profiler.stopPreciseCoverage";
269 type ReturnObject = StopPreciseCoverageReturnObject;
270}
271#[allow(deprecated)]
272impl Method for TakePreciseCoverage {
273 const NAME: &'static str = "Profiler.takePreciseCoverage";
274 type ReturnObject = TakePreciseCoverageReturnObject;
275}
276#[allow(dead_code)]
277pub mod events {
278 #[allow(unused_imports)]
279 use super::super::types::*;
280 #[allow(unused_imports)]
281 use derive_builder::Builder;
282 #[allow(unused_imports)]
283 use serde::{Deserialize, Serialize};
284 #[allow(unused_imports)]
285 use serde_json::Value as Json;
286 #[allow(deprecated)]
287 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
288 pub struct ConsoleProfileFinishedEvent {
289 pub params: ConsoleProfileFinishedEventParams,
290 }
291 #[allow(deprecated)]
292 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
293 #[serde(rename_all = "camelCase")]
294 pub struct ConsoleProfileFinishedEventParams {
295 #[serde(default)]
296 pub id: String,
297 #[doc = "Location of console.profileEnd()."]
298 pub location: super::super::debugger::Location,
299 pub profile: super::Profile,
300 #[builder(default)]
301 #[serde(skip_serializing_if = "Option::is_none")]
302 #[serde(default)]
303 #[doc = "Profile title passed as an argument to console.profile()."]
304 pub title: Option<String>,
305 }
306 #[allow(deprecated)]
307 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
308 pub struct ConsoleProfileStartedEvent {
309 pub params: ConsoleProfileStartedEventParams,
310 }
311 #[allow(deprecated)]
312 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
313 #[serde(rename_all = "camelCase")]
314 pub struct ConsoleProfileStartedEventParams {
315 #[serde(default)]
316 pub id: String,
317 #[doc = "Location of console.profile()."]
318 pub location: super::super::debugger::Location,
319 #[builder(default)]
320 #[serde(skip_serializing_if = "Option::is_none")]
321 #[serde(default)]
322 #[doc = "Profile title passed as an argument to console.profile()."]
323 pub title: Option<String>,
324 }
325 #[allow(deprecated)]
326 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
327 pub struct PreciseCoverageDeltaUpdateEvent {
328 pub params: PreciseCoverageDeltaUpdateEventParams,
329 }
330 #[allow(deprecated)]
331 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
332 #[serde(rename_all = "camelCase")]
333 pub struct PreciseCoverageDeltaUpdateEventParams {
334 #[serde(default)]
335 #[doc = "Monotonically increasing time (in seconds) when the coverage update was taken in the backend."]
336 pub timestamp: JsFloat,
337 #[serde(default)]
338 #[doc = "Identifier for distinguishing coverage events."]
339 pub occasion: String,
340 #[doc = "Coverage data for the current isolate."]
341 pub result: Vec<super::ScriptCoverage>,
342 }
343}