fix: inaccurate to report stats for total, feat: add average response time in total.

This commit is contained in:
徐聪
2022-01-19 19:55:06 +08:00
parent 573c2d79ad
commit 2f07c9ac0b
3 changed files with 57 additions and 36 deletions
+3 -2
View File
@@ -58,14 +58,15 @@ func TestGetAvgContentLength(t *testing.T) {
}
func TestGetCurrentRps(t *testing.T) {
duration := float64(3)
numRequests := int64(6)
currentRps := getCurrentRps(numRequests)
currentRps := getCurrentRps(numRequests, duration)
if currentRps != 2 {
t.Error("currentRps should be 2")
}
numRequests = int64(8)
currentRps = getCurrentRps(numRequests)
currentRps = getCurrentRps(numRequests, duration)
if fmt.Sprintf("%.2f", currentRps) != "2.67" {
t.Error("currentRps should be 2.67")
}