/
types.go
150 lines (127 loc) · 4.3 KB
/
types.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
// Code generated by cdpgen. DO NOT EDIT.
package tracing
import (
"encoding/json"
"errors"
)
// MemoryDumpConfig Configuration for memory dump. Used only when
// "memory-infra" category is enabled.
type MemoryDumpConfig []byte
// MarshalJSON copies behavior of json.RawMessage.
func (m MemoryDumpConfig) MarshalJSON() ([]byte, error) {
if m == nil {
return []byte("null"), nil
}
return m, nil
}
// UnmarshalJSON copies behavior of json.RawMessage.
func (m *MemoryDumpConfig) UnmarshalJSON(data []byte) error {
if m == nil {
return errors.New("tracing.MemoryDumpConfig: UnmarshalJSON on nil pointer")
}
*m = append((*m)[0:0], data...)
return nil
}
var _ json.Marshaler = (*MemoryDumpConfig)(nil)
var _ json.Unmarshaler = (*MemoryDumpConfig)(nil)
// TraceConfig
type TraceConfig struct {
// RecordMode Controls how the trace buffer stores data.
//
// Values: "recordUntilFull", "recordContinuously", "recordAsMuchAsPossible", "echoToConsole".
RecordMode *string `json:"recordMode,omitempty"`
EnableSampling *bool `json:"enableSampling,omitempty"` // Turns on JavaScript stack sampling.
EnableSystrace *bool `json:"enableSystrace,omitempty"` // Turns on system tracing.
EnableArgumentFilter *bool `json:"enableArgumentFilter,omitempty"` // Turns on argument filter.
IncludedCategories []string `json:"includedCategories,omitempty"` // Included category filters.
ExcludedCategories []string `json:"excludedCategories,omitempty"` // Excluded category filters.
SyntheticDelays []string `json:"syntheticDelays,omitempty"` // Configuration to synthesize the delays in tracing.
MemoryDumpConfig MemoryDumpConfig `json:"memoryDumpConfig,omitempty"` // Configuration for memory dump triggers. Used only when "memory-infra" category is enabled.
}
// StreamFormat 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 StreamFormat string
// StreamFormat as enums.
const (
StreamFormatNotSet StreamFormat = ""
StreamFormatJSON StreamFormat = "json"
StreamFormatProto StreamFormat = "proto"
)
func (e StreamFormat) Valid() bool {
switch e {
case "json", "proto":
return true
default:
return false
}
}
func (e StreamFormat) String() string {
return string(e)
}
// StreamCompression Compression type to use for traces returned via streams.
type StreamCompression string
// StreamCompression as enums.
const (
StreamCompressionNotSet StreamCompression = ""
StreamCompressionNone StreamCompression = "none"
StreamCompressionGzip StreamCompression = "gzip"
)
func (e StreamCompression) Valid() bool {
switch e {
case "none", "gzip":
return true
default:
return false
}
}
func (e StreamCompression) String() string {
return string(e)
}
// MemoryDumpLevelOfDetail Details exposed when memory request explicitly
// declared. Keep consistent with memory_dump_request_args.h and
// memory_instrumentation.mojom
type MemoryDumpLevelOfDetail string
// MemoryDumpLevelOfDetail as enums.
const (
MemoryDumpLevelOfDetailNotSet MemoryDumpLevelOfDetail = ""
MemoryDumpLevelOfDetailBackground MemoryDumpLevelOfDetail = "background"
MemoryDumpLevelOfDetailLight MemoryDumpLevelOfDetail = "light"
MemoryDumpLevelOfDetailDetailed MemoryDumpLevelOfDetail = "detailed"
)
func (e MemoryDumpLevelOfDetail) Valid() bool {
switch e {
case "background", "light", "detailed":
return true
default:
return false
}
}
func (e MemoryDumpLevelOfDetail) String() string {
return string(e)
}
// Backend 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 Backend string
// Backend as enums.
const (
BackendNotSet Backend = ""
BackendAuto Backend = "auto"
BackendChrome Backend = "chrome"
BackendSystem Backend = "system"
)
func (e Backend) Valid() bool {
switch e {
case "auto", "chrome", "system":
return true
default:
return false
}
}
func (e Backend) String() string {
return string(e)
}