limit packet loss
This commit is contained in:
2
rtt.go
2
rtt.go
@@ -121,7 +121,7 @@ func (cp *ContinuousPinger) Stats(dSent, dReceive int) (*PingStats, error) {
|
||||
}
|
||||
}
|
||||
ps.AvgRtt = time.Duration(sum / int64(pkgsInArr))
|
||||
ps.PacketLoss = math.Min(100, 100-(float64(dReceive)/float64(dSent)*100))
|
||||
ps.PacketLoss = math.Min(100, math.Max(100-(float64(dReceive)/float64(dSent)*100), 0))
|
||||
stdDev, err := stats.StandardDeviation(rttArray)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user