update bench tool

This commit is contained in:
siddontang 2014-10-31 09:18:45 +08:00
parent c471b4538f
commit b787ddbbd1
1 changed files with 4 additions and 1 deletions

View File

@ -58,9 +58,10 @@ func bench(cmd string, f func()) {
var kvSetBase int64 = 0 var kvSetBase int64 = 0
var kvGetBase int64 = 0 var kvGetBase int64 = 0
var value []byte
func benchSet() { func benchSet() {
f := func() { f := func() {
value := make([]byte, *valueSize)
n := atomic.AddInt64(&kvSetBase, 1) n := atomic.AddInt64(&kvSetBase, 1)
db.Set(num.Int64ToBytes(n), value) db.Set(num.Int64ToBytes(n), value)
@ -122,6 +123,8 @@ func main() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())
flag.Parse() flag.Parse()
value = make([]byte, *valueSize)
cfg := config.NewConfigDefault() cfg := config.NewConfigDefault()
cfg.DataDir = "./var/ledis_dbbench" cfg.DataDir = "./var/ledis_dbbench"
cfg.DBName = *name cfg.DBName = *name