bench add kv value size flag

This commit is contained in:
siddontang 2014-10-23 13:49:43 +08:00
parent 66d5ef4541
commit 0a61b949e2
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ var clients = flag.Int("c", 50, "number of clients")
var reverse = flag.Bool("rev", false, "enable zset rev benchmark") var reverse = flag.Bool("rev", false, "enable zset rev benchmark")
var round = flag.Int("r", 1, "benchmark round number") var round = flag.Int("r", 1, "benchmark round number")
var del = flag.Bool("del", true, "enable del benchmark") var del = flag.Bool("del", true, "enable del benchmark")
var valueSize = flag.Int("vsize", 100, "kv value size")
var wg sync.WaitGroup var wg sync.WaitGroup
var client *ledis.Client var client *ledis.Client
@ -65,7 +65,7 @@ var kvDelBase int64 = 0
func benchSet() { func benchSet() {
f := func() { f := func() {
value := make([]byte, 100) value := make([]byte, *valueSize)
crand.Read(value) crand.Read(value)
n := atomic.AddInt64(&kvSetBase, 1) n := atomic.AddInt64(&kvSetBase, 1)
waitBench("set", n, value) waitBench("set", n, value)
@ -103,7 +103,7 @@ func benchDel() {
func benchPushList() { func benchPushList() {
f := func() { f := func() {
value := make([]byte, 10) value := make([]byte, 100)
crand.Read(value) crand.Read(value)
waitBench("rpush", "mytestlist", value) waitBench("rpush", "mytestlist", value)
} }