distinct benchmark types

the -t flag now supports set-point, set-rect, and set-string
This commit is contained in:
Josh Baker 2017-08-06 17:39:35 -07:00
parent cb062bded4
commit 91c44a5eef
1 changed files with 38 additions and 29 deletions

View File

@ -177,7 +177,7 @@ func main() {
return redbench.AppendCommand(buf, "PING") return redbench.AppendCommand(buf, "PING")
}, },
) )
case "SET": case "SET", "SET-POINT", "SET-RECT", "SET-STRING":
if redis { if redis {
redbench.Bench("SET", addr, fillOpts(), prepFn, redbench.Bench("SET", addr, fillOpts(), prepFn,
func(buf []byte) []byte { func(buf []byte) []byte {
@ -186,6 +186,8 @@ func main() {
) )
} else { } else {
var i int64 var i int64
switch strings.ToUpper(strings.TrimSpace(test)) {
case "SET", "SET-POINT":
redbench.Bench("SET (point)", addr, fillOpts(), prepFn, redbench.Bench("SET (point)", addr, fillOpts(), prepFn,
func(buf []byte) []byte { func(buf []byte) []byte {
i := atomic.AddInt64(&i, 1) i := atomic.AddInt64(&i, 1)
@ -196,6 +198,9 @@ func main() {
) )
}, },
) )
}
switch strings.ToUpper(strings.TrimSpace(test)) {
case "SET", "SET-RECT":
redbench.Bench("SET (rect)", addr, fillOpts(), prepFn, redbench.Bench("SET (rect)", addr, fillOpts(), prepFn,
func(buf []byte) []byte { func(buf []byte) []byte {
i := atomic.AddInt64(&i, 1) i := atomic.AddInt64(&i, 1)
@ -208,6 +213,9 @@ func main() {
) )
}, },
) )
}
switch strings.ToUpper(strings.TrimSpace(test)) {
case "SET", "SET-STRING":
redbench.Bench("SET (string)", addr, fillOpts(), prepFn, redbench.Bench("SET (string)", addr, fillOpts(), prepFn,
func(buf []byte) []byte { func(buf []byte) []byte {
i := atomic.AddInt64(&i, 1) i := atomic.AddInt64(&i, 1)
@ -215,6 +223,7 @@ func main() {
}, },
) )
} }
}
case "GET": case "GET":
if redis { if redis {
redbench.Bench("GET", addr, fillOpts(), prepFn, redbench.Bench("GET", addr, fillOpts(), prepFn,