aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/bench/generate.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-04-18 21:37:45 -0500
committerBen Johnson <benbjohnson@yahoo.com>2014-04-18 22:15:31 -0500
commita42d74da7e6b3162701ae17d59647a6880ccb6bf (patch)
treeb32ca009bfaeae67cc0db5e388ba574b07cfa333 /cmd/bolt/bench/generate.go
parentmove bench package to bench/cmd/bolt/bench (diff)
downloaddedo-a42d74da7e6b3162701ae17d59647a6880ccb6bf.tar.gz
dedo-a42d74da7e6b3162701ae17d59647a6880ccb6bf.tar.xz
Add 'bolt bench'.
This commit adds a flexible benchmarking tool to the 'bolt' CLI. It allows the user to separately specify the write mode and read mode (e.g. sequential random, etc). It also allows the user to isolate profiling to either the read or the writes. Currently the bench tool only supports "seq" read and write modes. It also does not support streaming of Bolt counters yet. Fixes #95. /cc @snormore
Diffstat (limited to 'cmd/bolt/bench/generate.go')
-rw-r--r--cmd/bolt/bench/generate.go24
1 files changed, 0 insertions, 24 deletions
diff --git a/cmd/bolt/bench/generate.go b/cmd/bolt/bench/generate.go
deleted file mode 100644
index 8c5554d..0000000
--- a/cmd/bolt/bench/generate.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package bench
-
-import (
- "fmt"
- "strings"
-
- "github.com/boltdb/bolt"
-)
-
-// Generate and write data to specified number of buckets/items.
-func GenerateDB(db *bolt.DB, numBuckets, numItemsPerBucket int) error {
- return db.Update(func(tx *bolt.Tx) error {
- for bucketIndex := 0; bucketIndex < numBuckets; bucketIndex++ {
- bucketName := fmt.Sprintf("bucket%08d")
- tx.CreateBucket([]byte(bucketName))
- bucket := tx.Bucket([]byte(bucketName))
- for i := 0; i < numItemsPerBucket; i++ {
- value := []byte(strings.Repeat("0", 100))
- bucket.Put([]byte(fmt.Sprintf("key%08d", i)), value)
- }
- }
- return nil
- })
-}