aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2015-04-12 09:36:45 -0600
committerBen Johnson <benbjohnson@yahoo.com>2015-04-12 09:36:45 -0600
commit3b449559cf34cbcc74460b59041a4399d3226e5a (patch)
tree15955ca4e7a74084984bb0228c2e3ff15d82dae0
parentMerge pull request #347 from mike-marcacci/patch-1 (diff)
downloaddedo-3b449559cf34cbcc74460b59041a4399d3226e5a.tar.gz
dedo-3b449559cf34cbcc74460b59041a4399d3226e5a.tar.xz
Add --path to bolt bench.
-rw-r--r--cmd/bolt/bench.go8
-rw-r--r--cmd/bolt/main.go2
2 files changed, 8 insertions, 2 deletions
diff --git a/cmd/bolt/bench.go b/cmd/bolt/bench.go
index 91af960..3ade8b8 100644
--- a/cmd/bolt/bench.go
+++ b/cmd/bolt/bench.go
@@ -31,8 +31,11 @@ func Bench(options *BenchOptions) {
fatal("number of iterations must be divisible by the batch size")
}
- // Find temporary location.
- path := tempfile()
+ // Generate temp path if one is not passed in.
+ path := options.Path
+ if path == "" {
+ path = tempfile()
+ }
if options.Clean {
defer os.Remove(path)
@@ -368,6 +371,7 @@ type BenchOptions struct {
FillPercent float64
NoSync bool
Clean bool
+ Path string
}
// BenchResults represents the performance results of the benchmark.
diff --git a/cmd/bolt/main.go b/cmd/bolt/main.go
index 183d1f2..0372e19 100644
--- a/cmd/bolt/main.go
+++ b/cmd/bolt/main.go
@@ -99,6 +99,7 @@ func NewApp() *cli.App {
&cli.Float64Flag{Name: "fill-percent", Value: bolt.DefaultFillPercent, Usage: "Fill percentage"},
&cli.BoolFlag{Name: "no-sync", Usage: "Skip fsync on every commit"},
&cli.BoolFlag{Name: "work", Usage: "Print the temp db and do not delete on exit"},
+ &cli.StringFlag{Name: "path", Usage: "Path to database to use"},
},
Action: func(c *cli.Context) {
statsInterval, err := time.ParseDuration(c.String("stats-interval"))
@@ -121,6 +122,7 @@ func NewApp() *cli.App {
FillPercent: c.Float64("fill-percent"),
NoSync: c.Bool("no-sync"),
Clean: !c.Bool("work"),
+ Path: c.String("path"),
})
},
}}