From c81ea2e33ea8707dc69877ae253b8687f48db721 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 10 Aug 2026 02:11:41 +0200 Subject: [PATCH] feat: report the ping distribution under --debug The test reports one average, which says nothing about how the samples were spread. A link averaging 5 ms because every probe took 5 ms and one averaging 5 ms because probes ranged from 1 to 30 ms are not the same link, and only the second explains a connection that feels unsteady. pro-bing already works min, max and standard deviation out in Statistics(), so this prints what is on hand. Replies are shown as a raw count rather than a loss percentage. Ten probes are too few to express as a rate, and ICMP is frequently policed separately from the data path, so a percentage would describe the server's ICMP handling more than the network. --- defs/server.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/defs/server.go b/defs/server.go index b5d195f..8ea9f8e 100644 --- a/defs/server.go +++ b/defs/server.go @@ -109,6 +109,19 @@ func (s *Server) ICMPPingAndJitter(count int, srcIp, network string) (float64, f stats := p.Statistics() + // A single figure hides how the samples were spread. The pinger already + // works these out, and the spread is what says whether a link is steady or + // merely fast on average. Raw counts rather than a loss percentage: ten + // probes are too few for a rate, and ICMP is often policed independently of + // the data path, so a percentage would say more about the server's ICMP + // handling than about the network. + output.WriteDebug("Ping over ICMP: min %.2f ms, avg %.2f ms, max %.2f ms, stddev %.2f ms, %d/%d replies\n", + float64(stats.MinRtt.Microseconds())/1000, + float64(stats.AvgRtt.Microseconds())/1000, + float64(stats.MaxRtt.Microseconds())/1000, + float64(stats.StdDevRtt.Microseconds())/1000, + stats.PacketsRecv, stats.PacketsSent) + var lastPing, jitter float64 for idx, rtt := range stats.Rtts { if idx != 0 {