Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved iperf_udp_recv() debug messages #1797

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/iperf_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ iperf_udp_recv(struct iperf_stream *sp)
int first_packet = 0;
double transit = 0, d = 0;
struct iperf_time sent_time, arrival_time, temp_time;
struct iperf_test *test = sp->test;

r = Nread_no_select(sp->socket, sp->buffer, size, Pudp);

Expand All @@ -73,7 +74,7 @@ iperf_udp_recv(struct iperf_stream *sp)
return r;

/* Only count bytes received while we're in the correct state. */
if (sp->test->state == TEST_RUNNING) {
if (test->state == TEST_RUNNING) {

/*
* For jitter computation below, it's important to know if this
Expand All @@ -87,7 +88,7 @@ iperf_udp_recv(struct iperf_stream *sp)
sp->result->bytes_received_this_interval += r;

/* Dig the various counters out of the incoming UDP packet */
if (sp->test->udp_counters_64bit) {
if (test->udp_counters_64bit) {
memcpy(&sec, sp->buffer, sizeof(sec));
memcpy(&usec, sp->buffer+4, sizeof(usec));
memcpy(&pcount, sp->buffer+8, sizeof(pcount));
Expand All @@ -109,7 +110,7 @@ iperf_udp_recv(struct iperf_stream *sp)
sent_time.usecs = usec;
}

if (sp->test->debug_level >= DEBUG_LEVEL_DEBUG)
if (test->debug_level >= DEBUG_LEVEL_DEBUG)
fprintf(stderr, "pcount %" PRIu64 " packet_count %" PRIu64 "\n", pcount, sp->packet_count);

/*
Expand All @@ -131,6 +132,8 @@ iperf_udp_recv(struct iperf_stream *sp)
if (pcount > sp->packet_count + 1) {
/* There's a gap so count that as a loss. */
sp->cnt_error += (pcount - 1) - sp->packet_count;
if (test->debug_level >= DEBUG_LEVEL_INFO)
fprintf(stderr, "LOST %" PRIu64 " PACKETS - received packet %" PRIu64 " but expected sequence %" PRIu64 " on stream %d\n", (pcount - sp->packet_count + 1), pcount, sp->packet_count + 1, sp->socket);
}
/* Update the highest sequence number seen so far. */
sp->packet_count = pcount;
Expand All @@ -152,8 +155,8 @@ iperf_udp_recv(struct iperf_stream *sp)
sp->cnt_error--;

/* Log the out-of-order packet */
if (sp->test->debug)
fprintf(stderr, "OUT OF ORDER - incoming packet sequence %" PRIu64 " but expected sequence %" PRIu64 " on stream %d", pcount, sp->packet_count + 1, sp->socket);
if (test->debug_level >= DEBUG_LEVEL_INFO)
fprintf(stderr, "OUT OF ORDER - received packet %" PRIu64 " but expected sequence %" PRIu64 " on stream %d\n", pcount, sp->packet_count + 1, sp->socket);
}

/*
Expand Down Expand Up @@ -183,7 +186,7 @@ iperf_udp_recv(struct iperf_stream *sp)
sp->jitter += (d - sp->jitter) / 16.0;
}
else {
if (sp->test->debug)
if (test->debug_level >= DEBUG_LEVEL_INFO)
printf("Late receive, state = %d\n", sp->test->state);
}

Expand Down
Loading