mirror of https://github.com/etcd-io/bbolt.git
Add --path to bolt bench.
parent
5edfe08f65
commit
3b449559cf
|
@ -31,8 +31,11 @@ func Bench(options *BenchOptions) {
|
||||||
fatal("number of iterations must be divisible by the batch size")
|
fatal("number of iterations must be divisible by the batch size")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find temporary location.
|
// Generate temp path if one is not passed in.
|
||||||
path := tempfile()
|
path := options.Path
|
||||||
|
if path == "" {
|
||||||
|
path = tempfile()
|
||||||
|
}
|
||||||
|
|
||||||
if options.Clean {
|
if options.Clean {
|
||||||
defer os.Remove(path)
|
defer os.Remove(path)
|
||||||
|
@ -368,6 +371,7 @@ type BenchOptions struct {
|
||||||
FillPercent float64
|
FillPercent float64
|
||||||
NoSync bool
|
NoSync bool
|
||||||
Clean bool
|
Clean bool
|
||||||
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
// BenchResults represents the performance results of the benchmark.
|
// BenchResults represents the performance results of the benchmark.
|
||||||
|
|
|
@ -99,6 +99,7 @@ func NewApp() *cli.App {
|
||||||
&cli.Float64Flag{Name: "fill-percent", Value: bolt.DefaultFillPercent, Usage: "Fill percentage"},
|
&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: "no-sync", Usage: "Skip fsync on every commit"},
|
||||||
&cli.BoolFlag{Name: "work", Usage: "Print the temp db and do not delete on exit"},
|
&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) {
|
Action: func(c *cli.Context) {
|
||||||
statsInterval, err := time.ParseDuration(c.String("stats-interval"))
|
statsInterval, err := time.ParseDuration(c.String("stats-interval"))
|
||||||
|
@ -121,6 +122,7 @@ func NewApp() *cli.App {
|
||||||
FillPercent: c.Float64("fill-percent"),
|
FillPercent: c.Float64("fill-percent"),
|
||||||
NoSync: c.Bool("no-sync"),
|
NoSync: c.Bool("no-sync"),
|
||||||
Clean: !c.Bool("work"),
|
Clean: !c.Bool("work"),
|
||||||
|
Path: c.String("path"),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue