Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ Flags:
--base-ref="HEAD" The git ref to be used as a baseline.
--bench="." Run only those benchmarks matching a regular
expression.
--bench-args="test -bench {{.Bench}} -run '^$' -benchmem -count {{.BenchCount}} {{.Packages}}"
--bench-args="test -bench {{.Bench}} -run '^$' -benchtime {{.Benchtime}} -benchmem -count {{.BenchCount}} {{.Packages}}"
Use these arguments to run benchmarks. It may
be a template.
--bench-cmd="go" The go command to use for benchmarks.
--bench-count=10 Run each benchmark n times.
--benchtime="1s" The -benchtime argument for the go test
command
--cache-dir="./tmp" The directory where benchmark output will
kept between runs.
--force-base Rerun benchmarks on the base reference even
Expand Down
4 changes: 3 additions & 1 deletion cmd/benchdiff/benchdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"golang.org/x/perf/benchstat"
)

const defaultBenchArgsTmpl = `test -bench {{.Bench}} -run '^$' -benchmem -count {{.BenchCount}} {{.Packages}}`
const defaultBenchArgsTmpl = `test -bench {{.Bench}} -run '^$' -benchtime {{.Benchtime}} -benchmem -count {{.BenchCount}} {{.Packages}}`

var benchstatVars = kong.Vars{
"AlphaDefault": "0.05",
Expand Down Expand Up @@ -54,6 +54,7 @@ var benchVars = kong.Vars{
"BenchCountHelp": `Run each benchmark n times.`,
"BenchHelp": `Run only those benchmarks matching a regular expression.`,
"BenchArgsHelp": `Use these arguments to run benchmarks. It may be a template.`,
"BenchtimeHelp": `The -benchtime argument for the go test command`,
"PackagesHelp": `Run benchmarks in these packages.`,
"BenchCmdHelp": `The go command to use for benchmarks.`,
"CacheDirHelp": `The directory where benchmark output will kept between runs.`,
Expand All @@ -71,6 +72,7 @@ var cli struct {
BenchArgs string `kong:"default=${BenchArgsDefault},help=${BenchArgsHelp}"`
BenchCmd string `kong:"default=${BenchCmdDefault},help=${BenchCmdHelp}"`
BenchCount int `kong:"default=10,help=${BenchCountHelp}"`
Benchtime string `kong:"default='1s',help=${BenchtimeHelp}"`
CacheDir string `kong:"type=dir,default=${CacheDirDefault},help=${CacheDirHelp}"`
ForceBase bool `kong:"help=${ForceBaseHelp}"`
GitCmd string `kong:"default=git,help=${GitCmdHelp}"`
Expand Down