From b787ddbbd19db74ccf5445ef751ce977066fb82d Mon Sep 17 00:00:00 2001 From: siddontang Date: Fri, 31 Oct 2014 09:18:45 +0800 Subject: [PATCH] update bench tool --- cmd/ledis-dbbench/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/ledis-dbbench/main.go b/cmd/ledis-dbbench/main.go index b2183ce..0ab8277 100644 --- a/cmd/ledis-dbbench/main.go +++ b/cmd/ledis-dbbench/main.go @@ -58,9 +58,10 @@ func bench(cmd string, f func()) { var kvSetBase int64 = 0 var kvGetBase int64 = 0 +var value []byte + func benchSet() { f := func() { - value := make([]byte, *valueSize) n := atomic.AddInt64(&kvSetBase, 1) db.Set(num.Int64ToBytes(n), value) @@ -122,6 +123,8 @@ func main() { runtime.GOMAXPROCS(runtime.NumCPU()) flag.Parse() + value = make([]byte, *valueSize) + cfg := config.NewConfigDefault() cfg.DataDir = "./var/ledis_dbbench" cfg.DBName = *name