Home | History | Annotate | Download | only in netperf2
      1 diff -urp src.orig/netserver.c src/netserver.c
      2 --- src.orig/netserver.c	2009-05-28 05:48:44.000000000 +0800
      3 +++ src/netserver.c	2010-05-22 11:43:40.000000000 +0800
      4 @@ -580,7 +580,7 @@ set_up_server(char hostname[], char port
      5      if ((bind (server_control, 
      6  	       local_res_temp->ai_addr, 
      7  	       local_res_temp->ai_addrlen) != SOCKET_ERROR) &&
      8 -	(listen (server_control,5) != SOCKET_ERROR))  {
      9 +	(listen (server_control, 512) != SOCKET_ERROR))  {
     10        not_listening = 0;
     11        break;
     12      }
     13 diff -urp src.orig/netsh.c src/netsh.c
     14 --- src.orig/netsh.c	2008-10-25 07:38:57.000000000 +0800
     15 +++ src/netsh.c	2010-05-22 11:44:29.000000000 +0800
     16 @@ -94,7 +94,7 @@ double atof(const char *);
     17   /* Some of the args take optional parameters. Since we are using */
     18   /* getopt to parse the command line, we will tell getopt that they do */
     19   /* not take parms, and then look for them ourselves */
     20 -#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"
     21 +#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"
     22  
     23  /************************************************************************/
     24  /*									*/
     25 @@ -186,6 +186,10 @@ int
     26    remote_interval_usecs,
     27    remote_interval_burst;
     28  
     29 +/* wait time between control/data connection establishment and
     30 +   start of data traffic 					*/
     31 +int wait_time_secs;
     32 +
     33  #if defined(WANT_INTERVALS) || defined(WANT_DEMO)
     34  
     35  int demo_mode;                    /* are we actually in demo mode? */
     36 @@ -275,6 +279,7 @@ Global options:\n\
     37      -p port,lport*    Specify netserver port number and/or local port\n\
     38      -P 0|1            Don't/Do display test headers\n\
     39      -r                Allow confidence to be hit on result only\n\
     40 +    -s time           Time to wait before starting data traffic\n\
     41      -t testname       Specify test to perform\n\
     42      -T lcpu,rcpu      Request netperf/netserver be bound to local/remote cpu\n\
     43      -v verbosity      Specify the verbosity level\n\
     44 @@ -816,6 +821,9 @@ scan_cmd_line(int argc, char *argv[])
     45  	test_time = 0;
     46        }
     47        break;
     48 +     case 's':
     49 +      wait_time_secs  =  convert(optarg);
     50 +      break;
     51      case 'v':
     52        /* say how much to say */
     53        verbosity = convert(optarg);
     54 diff -urp src.orig/netsh.h src/netsh.h
     55 --- src.orig/netsh.h	2008-02-20 06:48:52.000000000 +0800
     56 +++ src/netsh.h	2010-05-22 11:44:32.000000000 +0800
     57 @@ -91,6 +91,8 @@ extern int	
     58    test_bytes,		/* test ends on byte count		*/
     59    test_trans;		/* test ends on tran count		*/
     60  
     61 +extern int wait_time_secs;
     62 +
     63  /* the alignment conditions for the tests				*/
     64  extern int
     65    local_recv_align,	/* alignment for local receives		*/
     66 diff -urp src.orig/nettest_bsd.c src/nettest_bsd.c
     67 --- src.orig/nettest_bsd.c	2009-06-04 08:31:15.000000000 +0800
     68 +++ src/nettest_bsd.c	2010-05-22 11:43:09.000000000 +0800
     69 @@ -326,6 +326,12 @@ static struct timeval *temp_intvl_ptr = 
     70  #endif
     71  #endif
     72  
     73 +#define WAIT_BEFORE_DATA_TRAFFIC() \
     74 +{ \
     75 +  if (wait_time_secs) \
     76 +    sleep(wait_time_secs); \
     77 +} \
     78 +
     79  #ifdef WANT_DEMO
     80  #ifdef HAVE_GETHRTIME
     81  static hrtime_t demo_one;
     82 @@ -1836,6 +1842,8 @@ Size (bytes)\n\
     83      /* we'll see it here. If it didn't, we might as well start pumping */
     84      /* data. */ 
     85      
     86 +    WAIT_BEFORE_DATA_TRAFFIC();
     87 +    
     88      /* Set-up the test end conditions. For a stream test, they can be */
     89      /* either time or byte-count based. */
     90      
     91 @@ -2542,6 +2550,8 @@ Size (bytes)\n\
     92      /* we'll see it here. If it didn't, we might as well start pumping */
     93      /* data. */ 
     94      
     95 +    WAIT_BEFORE_DATA_TRAFFIC();
     96 +    
     97      /* Set-up the test end conditions. For a maerts test, they can be */
     98      /* either time or byte-count based. */
     99      
    100 @@ -4195,7 +4205,7 @@ Size (bytes)\n\
    101      tcp_stream_request->cpu_rate	=	remote_cpu_rate;
    102  
    103      if (test_time) {
    104 -      tcp_stream_request->test_length	=	test_time;
    105 +      tcp_stream_request->test_length	=	test_time + wait_time_secs;
    106      }
    107      else {
    108        tcp_stream_request->test_length	=	test_bytes;
    109 @@ -4286,6 +4296,8 @@ Size (bytes)\n\
    110         we'll see it here. If it didn't, we might as well start pumping
    111         data. */
    112      
    113 +    WAIT_BEFORE_DATA_TRAFFIC();
    114 +
    115      /* Set-up the test end conditions. For a stream test, they can be */
    116      /* either time or byte-count based. */
    117      
    118 @@ -5715,7 +5727,7 @@ Send   Recv    Send   Recv    usec/Tran 
    119        tcp_rr_request->so_rcvavoid	=	rem_rcvavoid;
    120        tcp_rr_request->so_sndavoid	=	rem_sndavoid;
    121        if (test_time) {
    122 -	tcp_rr_request->test_length	=	test_time;
    123 +	tcp_rr_request->test_length	=	test_time + wait_time_secs;
    124        }
    125        else {
    126  	tcp_rr_request->test_length	=	test_trans * -1;
    127 @@ -5777,6 +5789,8 @@ Send   Recv    Send   Recv    usec/Tran 
    128        
    129        exit(1);
    130      }
    131 +
    132 +    WAIT_BEFORE_DATA_TRAFFIC();
    133      
    134  #ifdef WIN32
    135      /* this is used so the timer thread can close the socket out from */
    136 @@ -6501,6 +6515,8 @@ bytes   bytes    secs            #      
    137            fflush(where);
    138         }
    139      }
    140 +
    141 +    WAIT_BEFORE_DATA_TRAFFIC();
    142      
    143  #ifdef WIN32
    144    /* this is used so the timer thread can close the socket out from */
    145 @@ -7375,7 +7391,7 @@ bytes  bytes  bytes   bytes  secs.   per
    146        udp_rr_request->so_rcvavoid	        = rem_rcvavoid;
    147        udp_rr_request->so_sndavoid	        = rem_sndavoid;
    148        if (test_time) {
    149 -	udp_rr_request->test_length	= test_time;
    150 +	udp_rr_request->test_length	= test_time + wait_time_secs;
    151        }
    152        else {
    153  	udp_rr_request->test_length	= test_trans * -1;
    154 @@ -7456,6 +7472,8 @@ bytes  bytes  bytes   bytes  secs.   per
    155      /* message after the accept on the remote. If it failed, we'll see it */
    156      /* here. If it didn't, we might as well start pumping data. */
    157      
    158 +    WAIT_BEFORE_DATA_TRAFFIC();
    159 +
    160      /* Set-up the test end conditions. For a request/response test, they */
    161      /* can be either time or transaction based. */
    162  
    163 @@ -8767,7 +8785,7 @@ Send   Recv    Send   Recv\n\
    164      tcp_conn_rr_request->so_rcvavoid	=	rem_rcvavoid;
    165      tcp_conn_rr_request->so_sndavoid	=	rem_sndavoid;
    166      if (test_time) {
    167 -      tcp_conn_rr_request->test_length	=	test_time;
    168 +      tcp_conn_rr_request->test_length	=	test_time + wait_time_secs;
    169      }
    170      else {
    171        tcp_conn_rr_request->test_length	=	test_trans * -1;
    172 @@ -10961,7 +10979,7 @@ Send   Recv    Send   Recv\n\
    173      tcp_rr_request->so_rcvavoid	        =	rem_rcvavoid;
    174      tcp_rr_request->so_sndavoid	        =	rem_sndavoid;
    175      if (test_time) {
    176 -      tcp_rr_request->test_length	=	test_time;
    177 +      tcp_rr_request->test_length	=	test_time + wait_time_secs;
    178      }
    179      else {
    180        tcp_rr_request->test_length	=	test_trans * -1;
    181 @@ -11038,6 +11056,8 @@ Send   Recv    Send   Recv\n\
    182      /* message after the accept on the remote. If it failed, we'll see it */
    183      /* here. If it didn't, we might as well start pumping data. */
    184      
    185 +    WAIT_BEFORE_DATA_TRAFFIC();
    186 +
    187      /* Set-up the test end conditions. For a request/response test, they */
    188      /* can be either time or transaction based. */
    189      
    190 @@ -12021,6 +12041,8 @@ Send   Recv    Send   Recv\n\
    191    /* Set-up the test end conditions. For a request/response test, they */
    192    /* can be either time or transaction based. */
    193    
    194 +  WAIT_BEFORE_DATA_TRAFFIC();
    195 +
    196    if (test_time) {
    197      /* The user wanted to end the test after a period of time. */
    198      times_up = 0;
    199