@@ -23,6 +23,7 @@ import (
23
23
24
24
"github.com/alecthomas/kong"
25
25
log "github.com/sirupsen/logrus"
26
+ "go.opentelemetry.io/ebpf-profiler/support"
26
27
"go.opentelemetry.io/ebpf-profiler/tracer"
27
28
_ "google.golang.org/grpc/encoding/proto"
28
29
)
@@ -122,7 +123,8 @@ type Flags struct {
122
123
123
124
BPF FlagsBPF `embed:"" prefix:"bpf-"`
124
125
125
- OfflineMode FlagsOfflineMode `embed:"" prefix:"offline-mode-"`
126
+ OfflineMode FlagsOfflineMode `embed:"" prefix:"offline-mode-"`
127
+ OffCPUThreshold uint `default:"0" help:"The per-mille probablity of off-CPU event being recorded."`
126
128
}
127
129
128
130
type ExitCode int
@@ -202,6 +204,11 @@ func (f Flags) Validate() ExitCode {
202
204
return ParseError ("Specified --offline-mode-upload without --offline-mode-storage-path." )
203
205
}
204
206
207
+ if f .OffCPUThreshold > support .OffCPUThresholdMax {
208
+ return ParseError ("Off-CPU threshold %d exceeds limit (max: %d)" ,
209
+ f .OffCPUThreshold , support .OffCPUThresholdMax )
210
+ }
211
+
205
212
return ExitSuccess
206
213
}
207
214
@@ -355,7 +362,7 @@ type FlagsBPF struct {
355
362
}
356
363
357
364
type FlagsOfflineMode struct {
358
- StoragePath string `help:"Enables offline mode, with the data stored at the given path."`
359
- RotationInterval time.Duration `default:"10m" help:"How often to rotate and compress the offline mode log."`
360
- Upload bool `help:"Run the uploader for data written in offline mode."`
365
+ StoragePath string `help:"Enables offline mode, with the data stored at the given path."`
366
+ RotationInterval time.Duration `default:"10m" help:"How often to rotate and compress the offline mode log."`
367
+ Upload bool `help:"Run the uploader for data written in offline mode."`
361
368
}
0 commit comments