aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/main.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-04-30 12:27:54 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-04-30 12:27:54 -0600
commitd48c4a20be33a5d5d8a891c120de83d148334cc6 (patch)
tree192814044780f9c8b84892b88d10a04de7e4956a /cmd/bolt/main.go
parentMerge pull request #146 from benbjohnson/bench-batch (diff)
downloaddedo-d48c4a20be33a5d5d8a891c120de83d148334cc6.tar.gz
dedo-d48c4a20be33a5d5d8a891c120de83d148334cc6.tar.xz
Add streaming stats to bolt bench.
This commit adds -stats-interval to the 'bolt bench' utility. By setting this argument to an interval greater than 0s, the benchmark tool will output stats as streaming JSON. This data can, in turn, be graphed to understand performance over time.
Diffstat (limited to 'cmd/bolt/main.go')
-rw-r--r--cmd/bolt/main.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/cmd/bolt/main.go b/cmd/bolt/main.go
index cb2d47a..3558500 100644
--- a/cmd/bolt/main.go
+++ b/cmd/bolt/main.go
@@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os"
+ "time"
"github.com/codegangsta/cli"
)
@@ -104,19 +105,26 @@ func NewApp() *cli.App {
&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"},
+ &cli.StringFlag{Name: "stats-interval", Value: "0s", Usage: "Continuous stats interval"},
},
Action: func(c *cli.Context) {
+ statsInterval, err := time.ParseDuration(c.String("stats-interval"))
+ if err != nil {
+ fatal(err)
+ }
+
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"),
- CPUProfile: c.String("cpuprofile"),
- MemProfile: c.String("memprofile"),
- BlockProfile: c.String("blockprofile"),
+ 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"),
+ CPUProfile: c.String("cpuprofile"),
+ MemProfile: c.String("memprofile"),
+ BlockProfile: c.String("blockprofile"),
+ StatsInterval: statsInterval,
})
},
}}