@@ -58,10 +58,10 @@ type TestResult struct {
5858 OverallQueryRates map [string ]interface {} `json:"OverallQueryRates"`
5959
6060 // Overall Client Quantiles
61- OverallClientQuantiles map [string ]interface {} `json:"OverallClientQuantiles "`
61+ OverallClientLatencies map [string ]interface {} `json:"OverallClientLatencies "`
6262
6363 // Overall Graph Internal Quantiles
64- OverallGraphInternalQuantiles map [string ]interface {} `json:"OverallGraphInternalQuantiles "`
64+ OverallGraphInternalLatencies map [string ]interface {} `json:"OverallGraphInternalLatencies "`
6565
6666 // Per second ( tick ) client stats
6767 ClientRunTimeStats map [int64 ]interface {} `json:"ClientRunTimeStats"`
@@ -165,34 +165,36 @@ func calculateRateMetrics(current, prev int64, took time.Duration) (rate float64
165165 return
166166}
167167
168- func generateQuantileMap (hist * hdrhistogram.Histogram ) (int64 , map [string ]float64 ) {
168+ func generateLatenciesMap (hist * hdrhistogram.Histogram ) (int64 , map [string ]float64 ) {
169169 ops := hist .TotalCount ()
170170 q0 := 0.0
171171 q50 := 0.0
172172 q95 := 0.0
173173 q99 := 0.0
174174 q999 := 0.0
175175 q100 := 0.0
176+ average := 0.0
176177 if ops > 0 {
177178 q0 = float64 (hist .ValueAtQuantile (0.0 )) / 10e2
178179 q50 = float64 (hist .ValueAtQuantile (50.0 )) / 10e2
179180 q95 = float64 (hist .ValueAtQuantile (95.0 )) / 10e2
180181 q99 = float64 (hist .ValueAtQuantile (99.0 )) / 10e2
181182 q999 = float64 (hist .ValueAtQuantile (99.90 )) / 10e2
182183 q100 = float64 (hist .ValueAtQuantile (100.0 )) / 10e2
184+ average = (hist .Mean () / float64 (1000.0 ))
183185 }
184186
185- mp := map [string ]float64 {"q0" : q0 , "q50" : q50 , "q95" : q95 , "q99" : q99 , "q999" : q999 , "q100" : q100 }
187+ mp := map [string ]float64 {"q0" : q0 , "q50" : q50 , "q95" : q95 , "q99" : q99 , "q999" : q999 , "q100" : q100 , "avg" : average }
186188 return ops , mp
187189}
188190
189- func GetOverallQuantiles (cmds []string , perQueryHistograms []* hdrhistogram.Histogram , totalsHistogram * hdrhistogram.Histogram ) map [string ]interface {} {
191+ func GetOverallLatencies (cmds []string , perQueryHistograms []* hdrhistogram.Histogram , totalsHistogram * hdrhistogram.Histogram ) map [string ]interface {} {
190192 perQueryQuantileMap := map [string ]interface {}{}
191193 for i , query := range cmds {
192- _ , quantileMap := generateQuantileMap (perQueryHistograms [i ])
194+ _ , quantileMap := generateLatenciesMap (perQueryHistograms [i ])
193195 perQueryQuantileMap [query ] = quantileMap
194196 }
195- _ , totalMap := generateQuantileMap (totalsHistogram )
197+ _ , totalMap := generateLatenciesMap (totalsHistogram )
196198 perQueryQuantileMap ["Total" ] = totalMap
197199 return perQueryQuantileMap
198200}
0 commit comments