diff --git a/src/monitor.c b/src/monitor.c index 79488d1..0307e3d 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -170,18 +170,17 @@ static void monitor_update(void) log_warn("monitor", "Failed to send %d packets/sec (%d total failures)", fail_rate, zsend.sendto_failures); } - + float hits; + if (!zsend.sent) { + hits = 0; + } else { + hits = zrecv.success_unique*100./zsend.sent; + } if (!zsend.complete) { // main display (during sending) number_string((zsend.sent - last_sent)/delta, send_rate, sizeof(send_rate)); number_string((zsend.sent/age), send_avg, sizeof(send_avg)); - float hits; - if (!zsend.sent) { - hits = 0; - } else { - hits = zrecv.success_unique*100./zsend.sent; - } fprintf(stderr, "%5s %0.0f%%%s; send: %u %sp/s (%sp/s avg); " "recv: %u %sp/s (%sp/s avg); " @@ -217,7 +216,7 @@ static void monitor_update(void) recv_avg, pcap_drop, pcap_drop_avg, - zrecv.success_unique*100./zsend.sent); + hits); } } last_now = now();