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 ac9565c0e8
commit 0ec6fe0dc3
3 changed files with 57 additions and 36 deletions

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")
}