mirror of https://github.com/ledisdb/ledisdb.git
update bench tool
This commit is contained in:
parent
c14ea7a3a7
commit
c471b4538f
|
@ -99,6 +99,8 @@ func run(c net.Conn) {
|
||||||
|
|
||||||
var rt time.Duration
|
var rt time.Duration
|
||||||
var wt time.Duration
|
var wt time.Duration
|
||||||
|
var st time.Duration
|
||||||
|
var gt time.Duration
|
||||||
|
|
||||||
rb := bufio.NewReaderSize(c, 10240)
|
rb := bufio.NewReaderSize(c, 10240)
|
||||||
wb := bufio.NewWriterSize(c, 10240)
|
wb := bufio.NewWriterSize(c, 10240)
|
||||||
|
@ -124,11 +126,13 @@ func run(c net.Conn) {
|
||||||
case "SET":
|
case "SET":
|
||||||
if db != nil {
|
if db != nil {
|
||||||
db.Set(req[1], req[2])
|
db.Set(req[1], req[2])
|
||||||
|
st += time.Now().Sub(t2)
|
||||||
}
|
}
|
||||||
wb.Write(ok)
|
wb.Write(ok)
|
||||||
case "GET":
|
case "GET":
|
||||||
if db != nil {
|
if db != nil {
|
||||||
d, _ := db.GetSlice(req[1])
|
d, _ := db.GetSlice(req[1])
|
||||||
|
gt += time.Now().Sub(t2)
|
||||||
if d == nil {
|
if d == nil {
|
||||||
wb.Write(data)
|
wb.Write(data)
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,5 +154,5 @@ func run(c net.Conn) {
|
||||||
wt += t3.Sub(t2)
|
wt += t3.Sub(t2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("rt:%s wt:%s\n", rt.String(), wt.String())
|
fmt.Printf("rt:%s wt %s, gt:%s, st:%s\n", rt.String(), wt.String(), gt.String(), st.String())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue