Skip to content

Commit

Permalink
add a sleep of 1 second to even numbered streams for CC testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Tierney committed Jun 4, 2021
1 parent 592ff1f commit f853b68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ iperf_create_streams(struct iperf_test *test, int sender)
#if defined(HAVE_TCP_CONGESTION)
if (test->protocol->id == Ptcp) {
if (test->congestion) {
if(sender_id % 2 == 0) { /* only do this for even numbered senders */
if(sender_id % 2 == 0) { /* CC testing hack: only do this for even numbered senders */
/*
printf("setting cong cntrl on stream %d to %s \n",sender_id,test->congestion);
*/
Expand All @@ -85,7 +85,14 @@ iperf_create_streams(struct iperf_test *test, int sender)
i_errno = IESETCONGESTION;
return -1;
}
}
} else { /* for CC hack: sleep N seconds to give even numbered streams (eg: cubic) a head start */
int sleep_time = 1;
/*
printf("default cong cntrl on stream %d \n",sender_id);
printf("sleeping for %d seconds to let stream %d have a head start \n",sleep_time, sender_id-1);
*/
sleep(sleep_time);
}
sender_id++;
}
{
Expand Down
4 changes: 3 additions & 1 deletion src/iperf_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,12 @@ iperf_tcp_connect(struct iperf_test *test)
}

/* for CC hack, sleep for a random number of usec between 0 and 500 ms */
/*
srand(time(0));
sleepTime = (useconds_t)(((rand() % 5) + 1) * 1000);
/* printf("DEBUG: sleeping for %d us \n", sleepTime); */
printf("DEBUG: sleeping for %d us \n", sleepTime);
usleep(sleepTime);
*/

if ((s = socket(server_res->ai_family, SOCK_STREAM, 0)) < 0) {
if (test->bind_address)
Expand Down

0 comments on commit f853b68

Please sign in to comment.