-
-
Notifications
You must be signed in to change notification settings - Fork 352
/
tracing.go
298 lines (223 loc) · 11.1 KB
/
tracing.go
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
// This file is generated by "./lib/proto/generate"
package proto
import (
"github.com/ysmood/gson"
)
/*
Tracing
*/
// TracingMemoryDumpConfig (experimental) Configuration for memory dump. Used only when "memory-infra" category is enabled.
type TracingMemoryDumpConfig map[string]gson.JSON
// TracingTraceConfigRecordMode enum.
type TracingTraceConfigRecordMode string
const (
// TracingTraceConfigRecordModeRecordUntilFull enum const.
TracingTraceConfigRecordModeRecordUntilFull TracingTraceConfigRecordMode = "recordUntilFull"
// TracingTraceConfigRecordModeRecordContinuously enum const.
TracingTraceConfigRecordModeRecordContinuously TracingTraceConfigRecordMode = "recordContinuously"
// TracingTraceConfigRecordModeRecordAsMuchAsPossible enum const.
TracingTraceConfigRecordModeRecordAsMuchAsPossible TracingTraceConfigRecordMode = "recordAsMuchAsPossible"
// TracingTraceConfigRecordModeEchoToConsole enum const.
TracingTraceConfigRecordModeEchoToConsole TracingTraceConfigRecordMode = "echoToConsole"
)
// TracingTraceConfig ...
type TracingTraceConfig struct {
// RecordMode (experimental) (optional) Controls how the trace buffer stores data.
RecordMode TracingTraceConfigRecordMode `json:"recordMode,omitempty"`
// TraceBufferSizeInKb (experimental) (optional) Size of the trace buffer in kilobytes. If not specified or zero is passed, a default value
// of 200 MB would be used.
TraceBufferSizeInKb *float64 `json:"traceBufferSizeInKb,omitempty"`
// EnableSampling (experimental) (optional) Turns on JavaScript stack sampling.
EnableSampling bool `json:"enableSampling,omitempty"`
// EnableSystrace (experimental) (optional) Turns on system tracing.
EnableSystrace bool `json:"enableSystrace,omitempty"`
// EnableArgumentFilter (experimental) (optional) Turns on argument filter.
EnableArgumentFilter bool `json:"enableArgumentFilter,omitempty"`
// IncludedCategories (optional) Included category filters.
IncludedCategories []string `json:"includedCategories,omitempty"`
// ExcludedCategories (optional) Excluded category filters.
ExcludedCategories []string `json:"excludedCategories,omitempty"`
// SyntheticDelays (experimental) (optional) Configuration to synthesize the delays in tracing.
SyntheticDelays []string `json:"syntheticDelays,omitempty"`
// MemoryDumpConfig (experimental) (optional) Configuration for memory dump triggers. Used only when "memory-infra" category is enabled.
MemoryDumpConfig TracingMemoryDumpConfig `json:"memoryDumpConfig,omitempty"`
}
// TracingStreamFormat (experimental) Data format of a trace. Can be either the legacy JSON format or the
// protocol buffer format. Note that the JSON format will be deprecated soon.
type TracingStreamFormat string
const (
// TracingStreamFormatJSON enum const.
TracingStreamFormatJSON TracingStreamFormat = "json"
// TracingStreamFormatProto enum const.
TracingStreamFormatProto TracingStreamFormat = "proto"
)
// TracingStreamCompression (experimental) Compression type to use for traces returned via streams.
type TracingStreamCompression string
const (
// TracingStreamCompressionNone enum const.
TracingStreamCompressionNone TracingStreamCompression = "none"
// TracingStreamCompressionGzip enum const.
TracingStreamCompressionGzip TracingStreamCompression = "gzip"
)
// TracingMemoryDumpLevelOfDetail (experimental) Details exposed when memory request explicitly declared.
// Keep consistent with memory_dump_request_args.h and
// memory_instrumentation.mojom.
type TracingMemoryDumpLevelOfDetail string
const (
// TracingMemoryDumpLevelOfDetailBackground enum const.
TracingMemoryDumpLevelOfDetailBackground TracingMemoryDumpLevelOfDetail = "background"
// TracingMemoryDumpLevelOfDetailLight enum const.
TracingMemoryDumpLevelOfDetailLight TracingMemoryDumpLevelOfDetail = "light"
// TracingMemoryDumpLevelOfDetailDetailed enum const.
TracingMemoryDumpLevelOfDetailDetailed TracingMemoryDumpLevelOfDetail = "detailed"
)
// TracingTracingBackend (experimental) Backend type to use for tracing. `chrome` uses the Chrome-integrated
// tracing service and is supported on all platforms. `system` is only
// supported on Chrome OS and uses the Perfetto system tracing service.
// `auto` chooses `system` when the perfettoConfig provided to Tracing.start
// specifies at least one non-Chrome data source; otherwise uses `chrome`.
type TracingTracingBackend string
const (
// TracingTracingBackendAuto enum const.
TracingTracingBackendAuto TracingTracingBackend = "auto"
// TracingTracingBackendChrome enum const.
TracingTracingBackendChrome TracingTracingBackend = "chrome"
// TracingTracingBackendSystem enum const.
TracingTracingBackendSystem TracingTracingBackend = "system"
)
// TracingEnd Stop trace events collection.
type TracingEnd struct{}
// ProtoReq name.
func (m TracingEnd) ProtoReq() string { return "Tracing.end" }
// Call sends the request.
func (m TracingEnd) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// TracingGetCategories (experimental) Gets supported tracing categories.
type TracingGetCategories struct{}
// ProtoReq name.
func (m TracingGetCategories) ProtoReq() string { return "Tracing.getCategories" }
// Call the request.
func (m TracingGetCategories) Call(c Client) (*TracingGetCategoriesResult, error) {
var res TracingGetCategoriesResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// TracingGetCategoriesResult (experimental) ...
type TracingGetCategoriesResult struct {
// Categories A list of supported tracing categories.
Categories []string `json:"categories"`
}
// TracingRecordClockSyncMarker (experimental) Record a clock sync marker in the trace.
type TracingRecordClockSyncMarker struct {
// SyncID The ID of this clock sync marker
SyncID string `json:"syncId"`
}
// ProtoReq name.
func (m TracingRecordClockSyncMarker) ProtoReq() string { return "Tracing.recordClockSyncMarker" }
// Call sends the request.
func (m TracingRecordClockSyncMarker) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// TracingRequestMemoryDump (experimental) Request a global memory dump.
type TracingRequestMemoryDump struct {
// Deterministic (optional) Enables more deterministic results by forcing garbage collection
Deterministic bool `json:"deterministic,omitempty"`
// LevelOfDetail (optional) Specifies level of details in memory dump. Defaults to "detailed".
LevelOfDetail TracingMemoryDumpLevelOfDetail `json:"levelOfDetail,omitempty"`
}
// ProtoReq name.
func (m TracingRequestMemoryDump) ProtoReq() string { return "Tracing.requestMemoryDump" }
// Call the request.
func (m TracingRequestMemoryDump) Call(c Client) (*TracingRequestMemoryDumpResult, error) {
var res TracingRequestMemoryDumpResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// TracingRequestMemoryDumpResult (experimental) ...
type TracingRequestMemoryDumpResult struct {
// DumpGUID GUID of the resulting global memory dump.
DumpGUID string `json:"dumpGuid"`
// Success True iff the global memory dump succeeded.
Success bool `json:"success"`
}
// TracingStartTransferMode enum.
type TracingStartTransferMode string
const (
// TracingStartTransferModeReportEvents enum const.
TracingStartTransferModeReportEvents TracingStartTransferMode = "ReportEvents"
// TracingStartTransferModeReturnAsStream enum const.
TracingStartTransferModeReturnAsStream TracingStartTransferMode = "ReturnAsStream"
)
// TracingStart Start trace events collection.
type TracingStart struct {
// Categories (deprecated) (experimental) (optional) Category/tag filter
Categories string `json:"categories,omitempty"`
// Options (deprecated) (experimental) (optional) Tracing options
Options string `json:"options,omitempty"`
// BufferUsageReportingInterval (experimental) (optional) If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
BufferUsageReportingInterval *float64 `json:"bufferUsageReportingInterval,omitempty"`
// TransferMode (optional) Whether to report trace events as series of dataCollected events or to save trace to a
// stream (defaults to `ReportEvents`).
TransferMode TracingStartTransferMode `json:"transferMode,omitempty"`
// StreamFormat (optional) Trace data format to use. This only applies when using `ReturnAsStream`
// transfer mode (defaults to `json`).
StreamFormat TracingStreamFormat `json:"streamFormat,omitempty"`
// StreamCompression (experimental) (optional) Compression format to use. This only applies when using `ReturnAsStream`
// transfer mode (defaults to `none`)
StreamCompression TracingStreamCompression `json:"streamCompression,omitempty"`
// TraceConfig (optional) ...
TraceConfig *TracingTraceConfig `json:"traceConfig,omitempty"`
// PerfettoConfig (experimental) (optional) Base64-encoded serialized perfetto.protos.TraceConfig protobuf message
// When specified, the parameters `categories`, `options`, `traceConfig`
// are ignored.
PerfettoConfig []byte `json:"perfettoConfig,omitempty"`
// TracingBackend (experimental) (optional) Backend type (defaults to `auto`)
TracingBackend TracingTracingBackend `json:"tracingBackend,omitempty"`
}
// ProtoReq name.
func (m TracingStart) ProtoReq() string { return "Tracing.start" }
// Call sends the request.
func (m TracingStart) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// TracingBufferUsage (experimental) ...
type TracingBufferUsage struct {
// PercentFull (optional) A number in range [0..1] that indicates the used size of event buffer as a fraction of its
// total size.
PercentFull *float64 `json:"percentFull,omitempty"`
// EventCount (optional) An approximate number of events in the trace log.
EventCount *float64 `json:"eventCount,omitempty"`
// Value (optional) A number in range [0..1] that indicates the used size of event buffer as a fraction of its
// total size.
Value *float64 `json:"value,omitempty"`
}
// ProtoEvent name.
func (evt TracingBufferUsage) ProtoEvent() string {
return "Tracing.bufferUsage"
}
// TracingDataCollected (experimental) Contains a bucket of collected trace events. When tracing is stopped collected events will be
// sent as a sequence of dataCollected events followed by tracingComplete event.
type TracingDataCollected struct {
// Value ...
Value []map[string]gson.JSON `json:"value"`
}
// ProtoEvent name.
func (evt TracingDataCollected) ProtoEvent() string {
return "Tracing.dataCollected"
}
// TracingTracingComplete Signals that tracing is stopped and there is no trace buffers pending flush, all data were
// delivered via dataCollected events.
type TracingTracingComplete struct {
// DataLossOccurred Indicates whether some trace data is known to have been lost, e.g. because the trace ring
// buffer wrapped around.
DataLossOccurred bool `json:"dataLossOccurred"`
// Stream (optional) A handle of the stream that holds resulting trace data.
Stream IOStreamHandle `json:"stream,omitempty"`
// TraceFormat (optional) Trace data format of returned stream.
TraceFormat TracingStreamFormat `json:"traceFormat,omitempty"`
// StreamCompression (optional) Compression format of returned stream.
StreamCompression TracingStreamCompression `json:"streamCompression,omitempty"`
}
// ProtoEvent name.
func (evt TracingTracingComplete) ProtoEvent() string {
return "Tracing.tracingComplete"
}