fping 5.0 (unreleased)
======================
+## Incompatible Changes
+
+- In non-quiet loop and count mode, a line is printed for every lost packet
+ (#175, thanks @kbucheli):
+
+ ```
+ $ fping -D -c2 8.8.8.8 8.8.8.7
+ [1596092373.18423] 8.8.8.8 : [0], 84 bytes, 12.8 ms (12.8 avg, 0% loss)
+ [1596092374.18223] 8.8.8.7 : [0], timed out (NaN avg, 100% loss)
+ [1596092374.18424] 8.8.8.8 : [1], 84 bytes, 12.3 ms (12.5 avg, 0% loss)
+ [1596092375.18344] 8.8.8.7 : [1], timed out (NaN avg, 100% loss)
+
+ 8.8.8.8 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 12.3/12.5/12.8
+ 8.8.8.7 : xmt/rcv/%loss = 2/0/100%
+ ```
+
## New features
-- Refactored event loop, now allowing for period (-p) to be smaller than
- timeout (-t). The number of sent pings is now only incremented when the
- response is received or when the timeout happens, so that the loss statistic
- is always correct (especially important when using interval statistics (-Q)
- (#193).
+- The number of sent pings is only counted when the pings are received or have
+ timed out, ensuring that the loss ratio will be always correct. This makes it
+ possible, for example, to use loop mode (-l) with interval statistics (-Q)
+ and a timeout larger than period, without having the issue that initially
+ some pings would be reported as missing (#193)
+
- Improved precision of measurements from 10us to 1us (#136, thanks @tycho)
{
my $cmd = Test::Command->new(cmd => "fping -t100 -p 100 -o -c 5 8.8.8.7");
$cmd->exit_is_num(1);
-$cmd->stdout_is_eq("");
+$cmd->stdout_is_eq("8.8.8.7 : [0], timed out (NaN avg, 100% loss)
+8.8.8.7 : [1], timed out (NaN avg, 100% loss)
+8.8.8.7 : [2], timed out (NaN avg, 100% loss)
+8.8.8.7 : [3], timed out (NaN avg, 100% loss)
+8.8.8.7 : [4], timed out (NaN avg, 100% loss)
+");
$cmd->stderr_like(qr{^\s*8\.8\.8\.7 : xmt/rcv/%loss = 5/0/100%, outage\(ms\) = 50\d\s*$});
}
stats_add(h, event->ping_index, 0, -1);
+ if (per_recv_flag) {
+ if (timestamp_flag) {
+ printf("[%10.5f] ", (double)current_time_ns / 1e9);
+ }
+ printf("%-*s : [%d], timed out",
+ max_hostname_len, h->host, event->ping_index);
+ if(h->num_recv > 0) {
+ printf(" (%s avg, ", sprint_tm(h->total_time / h->num_recv));
+ }
+ else {
+ printf(" (NaN avg, ");
+ }
+ if (h->num_recv <= h->num_sent) {
+ printf("%d%% loss)",
+ ((h->num_sent - h->num_recv) * 100) / h->num_sent);
+ }
+ else {
+ printf("%d%% return)",
+ (h->num_recv_total * 100) / h->num_sent);
+ }
+ printf("\n");
+ }
+
/* do we need to send a retry? */
if (!loop_flag && !count_flag) {
if (h->num_sent < retry + 1) {
/* print received ping (unless --quiet) */
if (per_recv_flag) {
if (timestamp_flag) {
- printf("[%10.5f] ", (double)(recv_time / 1000000)/1000);
+ printf("[%10.5f] ", (double)recv_time / 1e9);
}
avg = h->total_time / h->num_recv;
printf("%-*s : [%d], %d bytes, %s ms",