Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ping: fix standard deviation for small, consistent ping times
Suppose we do 10 pings, and 5 take 10us, 5 take 11us. tsum2 is 1105, tsum is 105. We divide them, getting 110 and 10 respectively. tmdev is then llsqrt(110 - 10 * 10) = llsqrt(10) = 3us. But max-min is only 1us! The exact solution is sqrt(110.5 - 110.25) which is sqrt(0.25) = 0.5. The new code will (more) correctly compute llsqrt(0) = 0 as the answer. It takes care not to do any horrendous integer overflows if there's a lot of long pings (a few thousand >1s pings would overflow without this). Addresses: https://bugs.debian.org/907327 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
- Loading branch information