aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/main.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-04-18 21:37:45 -0500
committerBen Johnson <benbjohnson@yahoo.com>2014-04-18 22:15:31 -0500
commita42d74da7e6b3162701ae17d59647a6880ccb6bf (patch)
treeb32ca009bfaeae67cc0db5e388ba574b07cfa333 /cmd/bolt/main.go
parentmove bench package to bench/cmd/bolt/bench (diff)
downloaddedo-a42d74da7e6b3162701ae17d59647a6880ccb6bf.tar.gz
dedo-a42d74da7e6b3162701ae17d59647a6880ccb6bf.tar.xz
Add 'bolt bench'.
This commit adds a flexible benchmarking tool to the 'bolt' CLI. It allows the user to separately specify the write mode and read mode (e.g. sequential random, etc). It also allows the user to isolate profiling to either the read or the writes. Currently the bench tool only supports "seq" read and write modes. It also does not support streaming of Bolt counters yet. Fixes #95. /cc @snormore
Diffstat (limited to 'cmd/bolt/main.go')
-rw-r--r--cmd/bolt/main.go46
1 files changed, 24 insertions, 22 deletions
diff --git a/cmd/bolt/main.go b/cmd/bolt/main.go
index ac71631..719bf00 100644
--- a/cmd/bolt/main.go
+++ b/cmd/bolt/main.go
@@ -6,7 +6,6 @@ import (
"fmt"
"log"
"os"
- "strconv"
"github.com/codegangsta/cli"
)
@@ -92,30 +91,33 @@ func NewApp() *cli.App {
},
},
{
- Name: "generate",
- Usage: "Generate data for benchmarks",
- Action: func(c *cli.Context) {
- destPath := c.Args().Get(0)
- numBuckets, err := strconv.Atoi(c.Args().Get(1))
- if err != nil {
- fatal(err)
- }
- numItems, err := strconv.Atoi(c.Args().Get(2))
- if err != nil {
- fatal(err)
- }
- Generate(destPath, numBuckets, numItems)
- },
- },
- {
Name: "bench",
- Usage: "Run benchmarks on a given dataset",
+ Usage: "Performs a synthetic benchmark",
+ Flags: []cli.Flag{
+ &cli.StringFlag{Name: "profile-mode", Value: "rw", Usage: "Profile mode"},
+ &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: "key-size", Value: 8, Usage: "Key size"},
+ &cli.IntFlag{Name: "value-size", Value: 32, Usage: "Value 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) {
- srcPath := c.Args().Get(0)
- Bench(srcPath, "read", "sequential", 1)
+ Bench(&BenchOptions{
+ ProfileMode: c.String("profile-mode"),
+ WriteMode: c.String("write-mode"),
+ ReadMode: c.String("read-mode"),
+ Iterations: c.Int("count"),
+ KeySize: c.Int("key-size"),
+ ValueSize: c.Int("value-size"),
+ CPUProfile: c.String("cpuprofile"),
+ MemProfile: c.String("memprofile"),
+ BlockProfile: c.String("blockprofile"),
+ })
},
- },
- }
+ }}
return app
}