From c471b4538f701ba5a1ca8a808f5d35afe862c9b0 Mon Sep 17 00:00:00 2001 From: siddontang Date: Fri, 31 Oct 2014 08:55:31 +0800 Subject: [PATCH] update bench tool --- cmd/ledis-respbench/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/ledis-respbench/main.go b/cmd/ledis-respbench/main.go index 0be7da0..fcdf239 100644 --- a/cmd/ledis-respbench/main.go +++ b/cmd/ledis-respbench/main.go @@ -99,6 +99,8 @@ func run(c net.Conn) { var rt time.Duration var wt time.Duration + var st time.Duration + var gt time.Duration rb := bufio.NewReaderSize(c, 10240) wb := bufio.NewWriterSize(c, 10240) @@ -124,11 +126,13 @@ func run(c net.Conn) { case "SET": if db != nil { db.Set(req[1], req[2]) + st += time.Now().Sub(t2) } wb.Write(ok) case "GET": if db != nil { d, _ := db.GetSlice(req[1]) + gt += time.Now().Sub(t2) if d == nil { wb.Write(data) } else { @@ -150,5 +154,5 @@ func run(c net.Conn) { 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()) }