aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-05-12 15:34:07 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-05-12 15:34:07 -0600
commitb5ae095a8728b63a2cc6f946096f242358fe73ee (patch)
treea836c25d539da0f0290742c13d105d72fb30f579 /cmd
parentMerge pull request #160 from benbjohnson/fix-deletion (diff)
downloaddedo-b5ae095a8728b63a2cc6f946096f242358fe73ee.tar.gz
dedo-b5ae095a8728b63a2cc6f946096f242358fe73ee.tar.xz
Add -work flag to 'bolt bench'.
This commit adds a 'work' flag to the bolt bench utility so that databases generated by the bench CLI can be saved for analysis.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bolt/bench.go8
-rw-r--r--cmd/bolt/main.go2
2 files changed, 9 insertions, 1 deletions
diff --git a/cmd/bolt/bench.go b/cmd/bolt/bench.go
index fef8e54..e8bf376 100644
--- a/cmd/bolt/bench.go
+++ b/cmd/bolt/bench.go
@@ -33,7 +33,12 @@ func Bench(options *BenchOptions) {
// Find temporary location.
path := tempfile()
- defer os.Remove(path)
+
+ if options.Clean {
+ defer os.Remove(path)
+ } else {
+ println("work:", path)
+ }
// Create database.
db, err := bolt.Open(path, 0600)
@@ -275,6 +280,7 @@ type BenchOptions struct {
MemProfile string
BlockProfile string
StatsInterval time.Duration
+ Clean bool
}
// BenchResults represents the performance results of the benchmark.
diff --git a/cmd/bolt/main.go b/cmd/bolt/main.go
index 3397042..82b5e5c 100644
--- a/cmd/bolt/main.go
+++ b/cmd/bolt/main.go
@@ -106,6 +106,7 @@ func NewApp() *cli.App {
&cli.StringFlag{Name: "memprofile", Usage: "Memory profile output path"},
&cli.StringFlag{Name: "blockprofile", Usage: "Block profile output path"},
&cli.StringFlag{Name: "stats-interval", Value: "0s", Usage: "Continuous stats interval"},
+ &cli.BoolFlag{Name: "work", Usage: "Print the temp db and do not delete on exit"},
},
Action: func(c *cli.Context) {
statsInterval, err := time.ParseDuration(c.String("stats-interval"))
@@ -125,6 +126,7 @@ func NewApp() *cli.App {
MemProfile: c.String("memprofile"),
BlockProfile: c.String("blockprofile"),
StatsInterval: statsInterval,
+ Clean: !c.Bool("work"),
})
},
}}