Skip to content

Commit

Permalink
tetragon-bench: Add --rb-size/--rb-queue-size options
Browse files Browse the repository at this point in the history
Adding --rb-size/--rb-queue-size options to configure the
perf ring buffer size and ring buffer queue size.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
olsajiri committed Dec 19, 2022
1 parent 7342a37 commit cd655e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/tetragon-bench/bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ var (

traceBench *string
crd *string

rbSize *int
rbQueueSize *int
)

func init() {
rbSize = flag.Int("rb-size", 65535, "perf ring buffer size")
rbQueueSize = flag.Int("rb-queue-size", 65535, "ring buffer queue size")
debug = flag.Bool("debug", false, "enable debugging")
jsonEncode = flag.Bool("json-encode", false, "JSON encode the events and measure overhead")
baseline = flag.Bool("baseline", false, "run a baseline benchmark without tetragon")
Expand Down Expand Up @@ -89,6 +94,8 @@ func main() {
Trace: bench.TraceBenchNameOrPanic(*traceBench),
Crd: *crd,
CmdArgs: cmdArgs,
RBSize: *rbSize,
RBQueueSize: *rbQueueSize,
}

summary := bench.RunTraceBench(args)
Expand Down
5 changes: 5 additions & 0 deletions pkg/bench/bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type Arguments struct {
PrintEvents bool
JSONEncode bool
Baseline bool
RBSize int
RBQueueSize int
}

func readConfig(file string) (*config.GenericTracingConf, error) {
Expand Down Expand Up @@ -98,6 +100,9 @@ func runTetragon(ctx context.Context, configFile string, args *Arguments, summar
}
}

option.Config.RBSize = args.RBSize
option.Config.RBQueueSize = args.RBQueueSize

option.Config.BpfDir = bpf.MapPrefixPath()
option.Config.MapDir = bpf.MapPrefixPath()
obs := observer.NewObserver(configFile)
Expand Down

0 comments on commit cd655e6

Please sign in to comment.