diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-04-30 12:00:39 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-04-30 12:00:39 -0600 |
commit | 2bfb1b3db56490d10951f104a892347d1a6db632 (patch) | |
tree | 682ce04dd86fdfe06f1cb0fc2b084c56c7bdaded /cmd/bolt | |
parent | Remove bolt bench -stat. (diff) | |
parent | Add --batch-size to 'bolt bench'. (diff) | |
download | dedo-2bfb1b3db56490d10951f104a892347d1a6db632.tar.gz dedo-2bfb1b3db56490d10951f104a892347d1a6db632.tar.xz |
Merge branch 'bench-batch' into moar_bench
Conflicts:
cmd/bolt/bench.go
Diffstat (limited to 'cmd/bolt')
-rw-r--r-- | cmd/bolt/bench.go | 9 | ||||
-rw-r--r-- | cmd/bolt/main.go | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/cmd/bolt/bench.go b/cmd/bolt/bench.go index e1858df..10a5599 100644 --- a/cmd/bolt/bench.go +++ b/cmd/bolt/bench.go @@ -23,6 +23,13 @@ var benchBucketName = []byte("bench") func Bench(options *BenchOptions) { var results BenchResults + // Validate options. + if options.BatchSize == 0 { + options.BatchSize = options.Iterations + } else if options.Iterations%options.BatchSize != 0 { + fatal("number of iterations must be divisible by the batch size") + } + // Find temporary location. path := tempfile() defer os.Remove(path) @@ -232,9 +239,9 @@ type BenchOptions struct { WriteMode string ReadMode string Iterations int + BatchSize int KeySize int ValueSize int - BatchSize int CPUProfile string MemProfile string BlockProfile string diff --git a/cmd/bolt/main.go b/cmd/bolt/main.go index 041f4bb..cb2d47a 100644 --- a/cmd/bolt/main.go +++ b/cmd/bolt/main.go @@ -98,26 +98,22 @@ func NewApp() *cli.App { &cli.StringFlag{Name: "write-mode", Value: "seq", Usage: "Write mode"}, &cli.StringFlag{Name: "read-mode", Value: "seq", Usage: "Read mode"}, &cli.IntFlag{Name: "count", Value: 1000, Usage: "Item count"}, + &cli.IntFlag{Name: "batch-size", Usage: "Write batch size"}, &cli.IntFlag{Name: "key-size", Value: 8, Usage: "Key size"}, &cli.IntFlag{Name: "value-size", Value: 32, Usage: "Value size"}, - &cli.IntFlag{Name: "batch-size", Value: 0, Usage: "Write batch size"}, &cli.StringFlag{Name: "cpuprofile", Usage: "CPU profile output path"}, &cli.StringFlag{Name: "memprofile", Usage: "Memory profile output path"}, &cli.StringFlag{Name: "blockprofile", Usage: "Block profile output path"}, }, Action: func(c *cli.Context) { - bs := c.Int("batch-size") - if bs == 0 { - bs = c.Int("count") - } Bench(&BenchOptions{ ProfileMode: c.String("profile-mode"), WriteMode: c.String("write-mode"), ReadMode: c.String("read-mode"), Iterations: c.Int("count"), + BatchSize: c.Int("batch-size"), KeySize: c.Int("key-size"), ValueSize: c.Int("value-size"), - BatchSize: bs, CPUProfile: c.String("cpuprofile"), MemProfile: c.String("memprofile"), BlockProfile: c.String("blockprofile"), |