1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.
//! The `Performance` domain.
//!
//! Types, command parameters and event payloads for the `Performance`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].
use serde::{Deserialize, Serialize};
/// Run-time execution metric.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Metric {
/// Metric name.
pub name: String,
/// Metric value.
pub value: f64,
}
/// Disable collecting and reporting metrics.
///
/// Parameters of `Performance.disable`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}
impl crate::typed::Command for DisableParams {
const METHOD: &'static str = "Performance.disable";
type Returns = crate::typed::NoReturns;
}
/// Enable collecting and reporting metrics.
///
/// Parameters of `Performance.enable`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {
/// Time domain to use for collecting and reporting duration metrics.
#[serde(
rename = "timeDomain",
default,
skip_serializing_if = "Option::is_none"
)]
pub time_domain: Option<EnableTimeDomain>,
}
/// The values `timeDomain` accepts on `enable`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EnableTimeDomain {
/// `timeTicks`
#[serde(rename = "timeTicks")]
TimeTicks,
/// `threadTicks`
#[serde(rename = "threadTicks")]
ThreadTicks,
/// A value this vendored schema does not list. Chrome adds values ahead of
/// the published protocol, so an unrecognised one is kept as it arrived
/// rather than failing the payload it came in.
#[serde(untagged)]
Unrecognized(String),
}
impl crate::typed::Command for EnableParams {
const METHOD: &'static str = "Performance.enable";
type Returns = crate::typed::NoReturns;
}
/// Sets time domain to use for collecting and reporting duration metrics.
/// Note that this must be called before enabling metrics collection. Calling
/// this method while metrics collection is enabled returns an error.
///
/// Deprecated in the protocol.
///
/// Experimental: may change without notice.
///
/// Parameters of `Performance.setTimeDomain`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetTimeDomainParams {
/// Time domain
#[serde(rename = "timeDomain")]
pub time_domain: SetTimeDomainTimeDomain,
}
/// The values `timeDomain` accepts on `setTimeDomain`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetTimeDomainTimeDomain {
/// `timeTicks`
#[serde(rename = "timeTicks")]
TimeTicks,
/// `threadTicks`
#[serde(rename = "threadTicks")]
ThreadTicks,
/// A value this vendored schema does not list. Chrome adds values ahead of
/// the published protocol, so an unrecognised one is kept as it arrived
/// rather than failing the payload it came in.
#[serde(untagged)]
Unrecognized(String),
}
impl crate::typed::Command for SetTimeDomainParams {
const METHOD: &'static str = "Performance.setTimeDomain";
type Returns = crate::typed::NoReturns;
}
/// Retrieve current values of run-time metrics.
///
/// Parameters of `Performance.getMetrics`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetMetricsParams {}
/// What `Performance.getMetrics` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetMetricsReturns {
/// Current values for run-time metrics.
pub metrics: Vec<Metric>,
}
impl crate::typed::Command for GetMetricsParams {
const METHOD: &'static str = "Performance.getMetrics";
type Returns = GetMetricsReturns;
}
/// Current values of the metrics.
///
/// Payload of the `Performance.metrics` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct MetricsEvent {
/// Current values of the metrics.
pub metrics: Vec<Metric>,
/// Timestamp title.
pub title: String,
}
impl crate::typed::Event for MetricsEvent {
const METHOD: &'static str = "Performance.metrics";
}