| diff -urp src.orig/netserver.c src/netserver.c |
| --- src.orig/netserver.c 2009-05-28 05:48:44.000000000 +0800 |
| +++ src/netserver.c 2010-05-22 11:43:40.000000000 +0800 |
| @@ -580,7 +580,7 @@ set_up_server(char hostname[], char port |
| if ((bind (server_control, |
| local_res_temp->ai_addr, |
| local_res_temp->ai_addrlen) != SOCKET_ERROR) && |
| - (listen (server_control,5) != SOCKET_ERROR)) { |
| + (listen (server_control, 512) != SOCKET_ERROR)) { |
| not_listening = 0; |
| break; |
| } |
| diff -urp src.orig/netsh.c src/netsh.c |
| --- src.orig/netsh.c 2008-10-25 07:38:57.000000000 +0800 |
| +++ src/netsh.c 2010-05-22 11:44:29.000000000 +0800 |
| @@ -94,7 +94,7 @@ double atof(const char *); |
| /* Some of the args take optional parameters. Since we are using */ |
| /* getopt to parse the command line, we will tell getopt that they do */ |
| /* not take parms, and then look for them ourselves */ |
| -#define GLOBAL_CMD_LINE_ARGS "A:a:b:B:CcdDf:F:H:hi:I:k:K:l:L:n:NO:o:P:p:rt:T:v:VW:w:46" |
| +#define GLOBAL_CMD_LINE_ARGS "A:a:b:B:CcdDf:F:H:hi:I:k:K:l:L:n:NO:o:P:p:rt:s:T:v:VW:w:46" |
| |
| /************************************************************************/ |
| /* */ |
| @@ -186,6 +186,10 @@ int |
| remote_interval_usecs, |
| remote_interval_burst; |
| |
| +/* wait time between control/data connection establishment and |
| + start of data traffic */ |
| +int wait_time_secs; |
| + |
| #if defined(WANT_INTERVALS) || defined(WANT_DEMO) |
| |
| int demo_mode; /* are we actually in demo mode? */ |
| @@ -275,6 +279,7 @@ Global options:\n\ |
| -p port,lport* Specify netserver port number and/or local port\n\ |
| -P 0|1 Don't/Do display test headers\n\ |
| -r Allow confidence to be hit on result only\n\ |
| + -s time Time to wait before starting data traffic\n\ |
| -t testname Specify test to perform\n\ |
| -T lcpu,rcpu Request netperf/netserver be bound to local/remote cpu\n\ |
| -v verbosity Specify the verbosity level\n\ |
| @@ -816,6 +821,9 @@ scan_cmd_line(int argc, char *argv[]) |
| test_time = 0; |
| } |
| break; |
| + case 's': |
| + wait_time_secs = convert(optarg); |
| + break; |
| case 'v': |
| /* say how much to say */ |
| verbosity = convert(optarg); |
| diff -urp src.orig/netsh.h src/netsh.h |
| --- src.orig/netsh.h 2008-02-20 06:48:52.000000000 +0800 |
| +++ src/netsh.h 2010-05-22 11:44:32.000000000 +0800 |
| @@ -91,6 +91,8 @@ extern int |
| test_bytes, /* test ends on byte count */ |
| test_trans; /* test ends on tran count */ |
| |
| +extern int wait_time_secs; |
| + |
| /* the alignment conditions for the tests */ |
| extern int |
| local_recv_align, /* alignment for local receives */ |
| diff -urp src.orig/nettest_bsd.c src/nettest_bsd.c |
| --- src.orig/nettest_bsd.c 2009-06-04 08:31:15.000000000 +0800 |
| +++ src/nettest_bsd.c 2010-05-22 11:43:09.000000000 +0800 |
| @@ -326,6 +326,12 @@ static struct timeval *temp_intvl_ptr = |
| #endif |
| #endif |
| |
| +#define WAIT_BEFORE_DATA_TRAFFIC() \ |
| +{ \ |
| + if (wait_time_secs) \ |
| + sleep(wait_time_secs); \ |
| +} \ |
| + |
| #ifdef WANT_DEMO |
| #ifdef HAVE_GETHRTIME |
| static hrtime_t demo_one; |
| @@ -1836,6 +1842,8 @@ Size (bytes)\n\ |
| /* we'll see it here. If it didn't, we might as well start pumping */ |
| /* data. */ |
| |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| + |
| /* Set-up the test end conditions. For a stream test, they can be */ |
| /* either time or byte-count based. */ |
| |
| @@ -2542,6 +2550,8 @@ Size (bytes)\n\ |
| /* we'll see it here. If it didn't, we might as well start pumping */ |
| /* data. */ |
| |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| + |
| /* Set-up the test end conditions. For a maerts test, they can be */ |
| /* either time or byte-count based. */ |
| |
| @@ -4195,7 +4205,7 @@ Size (bytes)\n\ |
| tcp_stream_request->cpu_rate = remote_cpu_rate; |
| |
| if (test_time) { |
| - tcp_stream_request->test_length = test_time; |
| + tcp_stream_request->test_length = test_time + wait_time_secs; |
| } |
| else { |
| tcp_stream_request->test_length = test_bytes; |
| @@ -4286,6 +4296,8 @@ Size (bytes)\n\ |
| we'll see it here. If it didn't, we might as well start pumping |
| data. */ |
| |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| + |
| /* Set-up the test end conditions. For a stream test, they can be */ |
| /* either time or byte-count based. */ |
| |
| @@ -5715,7 +5727,7 @@ Send Recv Send Recv usec/Tran |
| tcp_rr_request->so_rcvavoid = rem_rcvavoid; |
| tcp_rr_request->so_sndavoid = rem_sndavoid; |
| if (test_time) { |
| - tcp_rr_request->test_length = test_time; |
| + tcp_rr_request->test_length = test_time + wait_time_secs; |
| } |
| else { |
| tcp_rr_request->test_length = test_trans * -1; |
| @@ -5777,6 +5789,8 @@ Send Recv Send Recv usec/Tran |
| |
| exit(1); |
| } |
| + |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| |
| #ifdef WIN32 |
| /* this is used so the timer thread can close the socket out from */ |
| @@ -6501,6 +6515,8 @@ bytes bytes secs # |
| fflush(where); |
| } |
| } |
| + |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| |
| #ifdef WIN32 |
| /* this is used so the timer thread can close the socket out from */ |
| @@ -7375,7 +7391,7 @@ bytes bytes bytes bytes secs. per |
| udp_rr_request->so_rcvavoid = rem_rcvavoid; |
| udp_rr_request->so_sndavoid = rem_sndavoid; |
| if (test_time) { |
| - udp_rr_request->test_length = test_time; |
| + udp_rr_request->test_length = test_time + wait_time_secs; |
| } |
| else { |
| udp_rr_request->test_length = test_trans * -1; |
| @@ -7456,6 +7472,8 @@ bytes bytes bytes bytes secs. per |
| /* message after the accept on the remote. If it failed, we'll see it */ |
| /* here. If it didn't, we might as well start pumping data. */ |
| |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| + |
| /* Set-up the test end conditions. For a request/response test, they */ |
| /* can be either time or transaction based. */ |
| |
| @@ -8767,7 +8785,7 @@ Send Recv Send Recv\n\ |
| tcp_conn_rr_request->so_rcvavoid = rem_rcvavoid; |
| tcp_conn_rr_request->so_sndavoid = rem_sndavoid; |
| if (test_time) { |
| - tcp_conn_rr_request->test_length = test_time; |
| + tcp_conn_rr_request->test_length = test_time + wait_time_secs; |
| } |
| else { |
| tcp_conn_rr_request->test_length = test_trans * -1; |
| @@ -10961,7 +10979,7 @@ Send Recv Send Recv\n\ |
| tcp_rr_request->so_rcvavoid = rem_rcvavoid; |
| tcp_rr_request->so_sndavoid = rem_sndavoid; |
| if (test_time) { |
| - tcp_rr_request->test_length = test_time; |
| + tcp_rr_request->test_length = test_time + wait_time_secs; |
| } |
| else { |
| tcp_rr_request->test_length = test_trans * -1; |
| @@ -11038,6 +11056,8 @@ Send Recv Send Recv\n\ |
| /* message after the accept on the remote. If it failed, we'll see it */ |
| /* here. If it didn't, we might as well start pumping data. */ |
| |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| + |
| /* Set-up the test end conditions. For a request/response test, they */ |
| /* can be either time or transaction based. */ |
| |
| @@ -12021,6 +12041,8 @@ Send Recv Send Recv\n\ |
| /* Set-up the test end conditions. For a request/response test, they */ |
| /* can be either time or transaction based. */ |
| |
| + WAIT_BEFORE_DATA_TRAFFIC(); |
| + |
| if (test_time) { |
| /* The user wanted to end the test after a period of time. */ |
| times_up = 0; |