closing issue #34, no more NaN in cooldown

This commit is contained in:
Zakir Durumeric 2013-08-30 01:21:21 -04:00
parent 7270b383d9
commit d1eeff167d

View File

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