From 6854ca415f358279c93066bf1115e91af1108493 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Wed, 30 Apr 2014 11:55:08 -0600 Subject: [PATCH] Remove bolt bench -stat. --- cmd/bolt/bench.go | 25 +------------------------ cmd/bolt/main.go | 2 -- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/cmd/bolt/bench.go b/cmd/bolt/bench.go index e80f51a..e1858df 100644 --- a/cmd/bolt/bench.go +++ b/cmd/bolt/bench.go @@ -7,7 +7,6 @@ import ( "io/ioutil" "math/rand" "os" - "reflect" "runtime" "runtime/pprof" "time" @@ -70,19 +69,6 @@ func Bench(options *BenchOptions) { fmt.Printf("# Write\t%v\t(%v/op)\t(%v op/sec)\n", results.WriteDuration, results.WriteOpDuration(), results.WriteOpsPerSecond()) fmt.Printf("# Read\t%v\t(%v/op)\t(%v op/sec)\n", results.ReadDuration, results.ReadOpDuration(), results.ReadOpsPerSecond()) fmt.Println("") - - if options.Stats { - fmt.Println("Transaction Stats") - printStruct(db.Stats().TxStats) - fmt.Println("") - db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(benchBucketName) - fmt.Println("Storage Stats") - printStruct(b.Stats()) - fmt.Println("") - return nil - }) - } } // Writes to the database. @@ -110,7 +96,7 @@ func benchWriteSequential(db *bolt.DB, options *BenchOptions, results *BenchResu } func benchWriteRandom(db *bolt.DB, options *BenchOptions, results *BenchResults) error { - r := rand.New(rand.NewSource(42)) + r := rand.New(rand.NewSource(time.Now().UnixNano())) return benchWriteWithSource(db, options, results, func() uint32 { return r.Uint32() }) } @@ -249,7 +235,6 @@ type BenchOptions struct { KeySize int ValueSize int BatchSize int - Stats bool CPUProfile string MemProfile string BlockProfile string @@ -304,11 +289,3 @@ func tempfile() string { os.Remove(f.Name()) return f.Name() } - -func printStruct(s interface{}) { - v := reflect.ValueOf(s) - t := reflect.TypeOf(s) - for i := 0; i < v.NumField(); i++ { - fmt.Printf(" %s: %v\n", t.Field(i).Name, v.Field(i).Interface()) - } -} diff --git a/cmd/bolt/main.go b/cmd/bolt/main.go index cab4e0e..041f4bb 100644 --- a/cmd/bolt/main.go +++ b/cmd/bolt/main.go @@ -104,7 +104,6 @@ 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.BoolFlag{Name: "stats", Usage: "Output storage and transaction stats"}, }, Action: func(c *cli.Context) { bs := c.Int("batch-size") @@ -122,7 +121,6 @@ func NewApp() *cli.App { CPUProfile: c.String("cpuprofile"), MemProfile: c.String("memprofile"), BlockProfile: c.String("blockprofile"), - Stats: c.Bool("stats"), }) }, }}