Skip to content

Commit

Permalink
apmbench: fix benchtime flag to align with gobench (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
1pkg authored Oct 25, 2024
1 parent 36add97 commit 7aab0f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions cmd/apmbench/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import (
"sort"
"strconv"
"strings"
"time"
)

var cfg struct {
Count uint
Benchtime time.Duration
Benchtime string
RunRE *regexp.Regexp
SkipRE *regexp.Regexp
// Sorted list of agents count to be used for benchmarking
Expand All @@ -36,7 +35,7 @@ func init() {
cfg.AgentsList = []int{1}

flag.UintVar(&cfg.Count, "count", 1, "run benchmarks `n` times")
flag.DurationVar(&cfg.Benchtime, "benchtime", time.Second, "run each benchmark for duration `d`")
flag.StringVar(&cfg.Benchtime, "benchtime", "1s", "run each benchmark for duration `d` or N times if `d` is of the form Nx")
flag.Func("run", "run only benchmarks matching `regexp`", func(restr string) error {
if restr != "" {
re, err := regexp.Compile(restr)
Expand Down
2 changes: 1 addition & 1 deletion cmd/apmbench/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func Run(
}

// Set `test.benchtime` flag based on the custom `benchtime` flag.
if err := flag.Set("test.benchtime", cfg.Benchtime.String()); err != nil {
if err := flag.Set("test.benchtime", cfg.Benchtime); err != nil {
return fmt.Errorf("failed to set test.benchtime flag: %w", err)
}

Expand Down

0 comments on commit 7aab0f3

Please sign in to comment.