@@ -23,6 +23,7 @@ import (
2323
2424 "github.com/alecthomas/kong"
2525 log "github.com/sirupsen/logrus"
26+ "go.opentelemetry.io/ebpf-profiler/support"
2627 "go.opentelemetry.io/ebpf-profiler/tracer"
2728 _ "google.golang.org/grpc/encoding/proto"
2829)
@@ -122,7 +123,8 @@ type Flags struct {
122123
123124 BPF FlagsBPF `embed:"" prefix:"bpf-"`
124125
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."`
126128}
127129
128130type ExitCode int
@@ -202,6 +204,11 @@ func (f Flags) Validate() ExitCode {
202204 return ParseError ("Specified --offline-mode-upload without --offline-mode-storage-path." )
203205 }
204206
207+ if f .OffCPUThreshold > support .OffCPUThresholdMax {
208+ return ParseError ("Off-CPU threshold %d exceeds limit (max: %d)" ,
209+ f .OffCPUThreshold , support .OffCPUThresholdMax )
210+ }
211+
205212 return ExitSuccess
206213}
207214
@@ -355,7 +362,7 @@ type FlagsBPF struct {
355362}
356363
357364type 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."`
361368}
0 commit comments