From 2d52dca88ee8756bc2b9764ecb8b3448a79180b4 Mon Sep 17 00:00:00 2001 From: siddontang Date: Wed, 29 Oct 2014 09:12:11 +0800 Subject: [PATCH] rename to dbbench using ledis --- cmd/{ledis-storebench => ledis-dbbench}/main.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) rename cmd/{ledis-storebench => ledis-dbbench}/main.go (92%) diff --git a/cmd/ledis-storebench/main.go b/cmd/ledis-dbbench/main.go similarity index 92% rename from cmd/ledis-storebench/main.go rename to cmd/ledis-dbbench/main.go index ce37750..7f02d04 100644 --- a/cmd/ledis-storebench/main.go +++ b/cmd/ledis-dbbench/main.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/siddontang/go/num" "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store" + "github.com/siddontang/ledisdb/ledis" "os" "runtime" "sync" @@ -24,7 +24,8 @@ var round = flag.Int("r", 1, "benchmark round number") var valueSize = flag.Int("vsize", 100, "kv value size") var wg sync.WaitGroup -var db *store.DB +var ldb *ledis.Ledis +var db *ledis.DB var loop int = 0 @@ -62,7 +63,7 @@ func benchSet() { value := make([]byte, *valueSize) n := atomic.AddInt64(&kvSetBase, 1) - db.Put(num.Int64ToBytes(n), value) + db.Set(num.Int64ToBytes(n), value) } bench("set", f) @@ -104,7 +105,7 @@ func main() { flag.Parse() cfg := config.NewConfigDefault() - cfg.DBPath = "./var/store_test" + cfg.DBPath = "./var/db_test" cfg.DBName = *name os.RemoveAll(cfg.DBPath) @@ -116,12 +117,14 @@ func main() { setRocksDB(&cfg.RocksDB) var err error - db, err = store.Open(cfg) + ldb, err = ledis.Open(cfg) if err != nil { panic(err) return } + db, _ = ldb.Select(0) + if *number <= 0 { panic("invalid number") return