Skip to content

Commit

Permalink
Merge pull request #42 from sishui/master
Browse files Browse the repository at this point in the history
fix requestTimeFloat integer divide by zero
  • Loading branch information
link1st committed Nov 24, 2020
2 parents 83a9e8a + 135e650 commit 46ccbb4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/statistics/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ func table(successNum, failureNum uint64, errCode map[int]int, qps, averageTime,
var (
speed int64
)

if requestTimeFloat > 0 {
speed = receivedBytes / int64(requestTimeFloat)
speed = int64(float64(receivedBytes) / requestTimeFloat)
} else {
speed = 0
}
// 打印的时长都为毫秒
result := fmt.Sprintf("%4.0fs│%7d│%7d│%7d│%8.2f│%8.2f│%8.2f│%8.2f│%8s|%8s│%v",
Expand Down

0 comments on commit 46ccbb4

Please sign in to comment.