@@ -63,11 +63,21 @@ void print_flags(struct ntttcp_test *test)
6363 if (test -> client_role )
6464 printf ("%s:\t %ld\n" , "sender socket buffer (bytes)" , test -> send_buf_size );
6565
66+ if (test -> warmup == 0 )
67+ printf ("%s:\t\t %s\n" , "test warm-up (sec)" , "no" );
68+ else
69+ printf ("%s:\t\t %d\n" , "test warm-up (sec)" , test -> warmup );
70+
6671 if (test -> duration == 0 )
6772 printf ("%s:\t\t %s\n" , "test duration (sec)" , "continuous" );
6873 else
6974 printf ("%s:\t\t %d\n" , "test duration (sec)" , test -> duration );
7075
76+ if (test -> cooldown == 0 )
77+ printf ("%s:\t\t %s\n" , "test cool-down (sec)" , "no" );
78+ else
79+ printf ("%s:\t\t %d\n" , "test cool-down (sec)" , test -> cooldown );
80+
7181 printf ("%s:\t %s\n" , "show system tcp retransmit" , test -> show_tcp_retransmit ? "yes" : "no" );
7282
7383 if (test -> save_xml_log )
@@ -80,7 +90,7 @@ void print_flags(struct ntttcp_test *test)
8090void print_usage ()
8191{
8292 printf ("Author: %s\n" , AUTHOR_NAME );
83- printf ("ntttcp: [-r|-s|-D|-M|-L|-e|-H|-P|-n|-l|-6|-u|-p|-f|-b|-t |-N|-R|-x|-V|-h|-m <mapping>\n\n" );
93+ printf ("ntttcp: [-r|-s|-D|-M|-L|-e|-H|-P|-n|-l|-6|-u|-p|-f|-b|-W|-t|-C |-N|-R|-x|-V|-h|-m <mapping>\n\n" );
8494 printf ("\t-r Run as a receiver\n" );
8595 printf ("\t-s Run as a sender\n" );
8696 printf ("\t-D Run as daemon\n" );
@@ -101,7 +111,9 @@ void print_usage()
101111 printf ("\t-f Fixed source port number, or starting port number [default: %d]\n" , DEFAULT_BASE_SRC_PORT );
102112 printf ("\t-b <buffer size> [default: %d (receiver); %d (sender)]\n" , DEFAULT_RECV_BUFFER_SIZE , DEFAULT_SEND_BUFFER_SIZE );
103113
104- printf ("\t-t Time of test duration in seconds [default: %d]\n" , DEFAULT_TEST_DURATION );
114+ printf ("\t-W Warm-up time in seconds [default: %d]\n" , DEFAULT_WARMUP_SEC );
115+ printf ("\t-t Time of test duration in seconds [default: %d]\n" , DEFAULT_TEST_DURATION );
116+ printf ("\t-C Cool-down time in seconds [default: %d]\n" , DEFAULT_COOLDOWN_SEC );
105117 printf ("\t-N No sync, senders will start sending as soon as possible\n" );
106118 printf ("\t Otherwise, will use 'destination port - 1' as sync port [default: %d]\n" , DEFAULT_BASE_DST_PORT - 1 );
107119
@@ -299,6 +311,16 @@ int verify_args(struct ntttcp_test *test)
299311 PRINT_INFO ("running test in continuous mode. please monitor throughput by other tools" );
300312 }
301313
314+ if (test -> warmup < 0 ) {
315+ test -> warmup = DEFAULT_WARMUP_SEC ;
316+ PRINT_INFO ("invalid test warm-up seconds provided. use the default value" );
317+ }
318+
319+ if (test -> cooldown < 0 ) {
320+ test -> cooldown = DEFAULT_COOLDOWN_SEC ;
321+ PRINT_INFO ("invalid test cool-down seconds provided. use the default value" );
322+ }
323+
302324 return NO_ERROR ;
303325}
304326
@@ -324,7 +346,9 @@ int parse_arguments(struct ntttcp_test *test, int argc, char **argv)
324346 {"base-dst-port", required_argument, NULL, 'p'},
325347 {"base-src-port", optional_argument, NULL, 'f'},
326348 {"buffer", required_argument, NULL, 'b'},
349+ {"warmup", required_argument, NULL, 'W'},
327350 {"duration", required_argument, NULL, 't'},
351+ {"cooldown", required_argument, NULL, 'C'},
328352 {"no-synch", no_argument, NULL, 'N'},
329353 {"show-retrans", no_argument, NULL, 'R'},
330354 {"save-xml", optional_argument, NULL, 'x'},
@@ -336,7 +360,7 @@ int parse_arguments(struct ntttcp_test *test, int argc, char **argv)
336360
337361 int opt ;
338362
339- while ((opt = getopt (argc , argv , "r::s::DMLeHm:P:n:l:6up:f::b:t :NRx::Vh" )) != -1 ) {
363+ while ((opt = getopt (argc , argv , "r::s::DMLeHm:P:n:l:6up:f::b:W:t:C :NRx::Vh" )) != -1 ) {
340364 switch (opt ) {
341365 case 'r' :
342366 case 's' :
@@ -420,10 +444,18 @@ int parse_arguments(struct ntttcp_test *test, int argc, char **argv)
420444 test -> send_buf_size = unit_atod (optarg );
421445 break ;
422446
447+ case 'W' :
448+ test -> warmup = atoi (optarg );
449+ break ;
450+
423451 case 't' :
424452 test -> duration = atoi (optarg );
425453 break ;
426454
455+ case 'C' :
456+ test -> cooldown = atoi (optarg );
457+ break ;
458+
427459 case 'N' :
428460 test -> no_synch = true;
429461 break ;
0 commit comments