@@ -223,6 +223,13 @@ def yes_and_no(y, n):
223
223
return 0
224
224
225
225
226
+ def gen_tcp_win_msg (tcpwin ):
227
+ if tcpwin :
228
+ return ', w=' + str (tcpwin )
229
+ else :
230
+ return ''
231
+
232
+
226
233
def dir_prep (d ):
227
234
if not isdir (d ):
228
235
try :
@@ -309,12 +316,13 @@ def place_images(direction, protocol, summary_img, image_list, print_unit,
309
316
310
317
def gen_html (title , one2two_summary , two2one_summary , one2two_images , two2one_images , html_outname ,
311
318
protocol , streams , all_one2two_failed , all_two2one_failed , print_unit , localpart ,
312
- cl1_pretty_name , cl2_pretty_name ):
319
+ cl1_pretty_name , cl2_pretty_name , tcpwin ):
313
320
if localpart :
314
321
CPU_note = 'and CPU '
315
322
else :
316
323
CPU_note = ''
317
324
325
+ tcp_win_msg = gen_tcp_win_msg (tcpwin )
318
326
content = (
319
327
'<!doctype html>\n '
320
328
'<html>\n '
@@ -391,7 +399,7 @@ def gen_html(title, one2two_summary, two2one_summary, one2two_images, two2one_im
391
399
'<body>\n '
392
400
'<div id="header">\n '
393
401
)
394
- content += (' <h3>' + title + ' [' + protocol + ', ' + str (streams ) + ' st.]</h3>\n '
402
+ content += (' <h3>' + title + ' [' + protocol + ', ' + str (streams ) + ' st.' + tcp_win_msg + ' ]</h3>\n '
395
403
'</div>\n '
396
404
'<div id="container">\n '
397
405
)
@@ -623,7 +631,7 @@ def plot_iperf_data(passed, plot_type, net_dat_file):
623
631
def write_gp (gp_outname , net_dat_file , proc_dat_file , img_file , net_rate ,
624
632
protocol , streams , print_unit , cl1_pretty_name , cl2_pretty_name ,
625
633
plot_type = 'singlesize' , direction = 'one2two' , finished = True ,
626
- server_fault = False , packet_size = 0.0 ):
634
+ server_fault = False , packet_size = 0.0 , tcpwin = None ):
627
635
try :
628
636
net_rate , rate_units , rate_factor = get_size_units_factor (net_rate , rate = True )
629
637
rate_format = ''
@@ -678,6 +686,7 @@ def write_gp(gp_outname, net_dat_file, proc_dat_file, img_file, net_rate,
678
686
y2_axis = ''
679
687
rmargin = 'set rmargin 4.5\n '
680
688
689
+ tcp_win_msg = gen_tcp_win_msg (tcpwin )
681
690
warning_message = ''
682
691
if not finished :
683
692
warning_message = 'set label "Warning:\\ nTest failed to finish!\\ nResults may not be accurate!" at screen 0.01, screen 0.96 tc rgb "red"\n '
@@ -691,7 +700,7 @@ def write_gp(gp_outname, net_dat_file, proc_dat_file, img_file, net_rate,
691
700
'set terminal pngcairo nocrop enhanced size 1024,768 font "Verdana,15"\n '
692
701
'set output "' + img_file + '"\n '
693
702
'\n '
694
- 'set title "{/=20 ' + plot_title + '}\\ n\\ n{/=18 (' + plot_subtitle + ', ' + protocol + ', ' + str (streams ) + ' st.)}"\n '
703
+ 'set title "{/=20 ' + plot_title + '}\\ n\\ n{/=18 (' + plot_subtitle + ', ' + protocol + ', ' + str (streams ) + ' st.' + tcp_win_msg + ' )}"\n '
695
704
+ rate_format + warning_message +
696
705
'\n '
697
706
'set xlabel "' + x_title + '"\n '
@@ -712,8 +721,10 @@ def write_gp(gp_outname, net_dat_file, proc_dat_file, img_file, net_rate,
712
721
outfile .write (content )
713
722
714
723
715
- def set_protocol_opts (protocol , client = True ):
716
- if protocol == 'TCP' :
724
+ def set_protocol_opts (protocol , tcpwin , client = True ):
725
+ if protocol == 'TCP' and tcpwin :
726
+ return ['-w' , str (tcpwin )]
727
+ elif protocol == 'TCP' :
717
728
return []
718
729
elif protocol == 'UDP' :
719
730
if client :
@@ -736,9 +747,9 @@ def bend_max_size(size, protocol):
736
747
return size
737
748
738
749
739
- def run_server (protocol , init_name , dir_time , conn ):
750
+ def run_server (protocol , init_name , dir_time , conn , tcpwin ):
740
751
iperf_args = ['-s' , '-i' , '10' , '-y' , 'C' ]
741
- protocol_opts = set_protocol_opts (protocol , client = False )
752
+ protocol_opts = set_protocol_opts (protocol , tcpwin , client = False )
742
753
iperf_args += protocol_opts
743
754
conn_name = conn .getname ()
744
755
iperf_command , output = conn .get_command (iperf_args , init_name + '_iperf.dat' , init_name + '_iperf.err' )
@@ -749,15 +760,15 @@ def run_server(protocol, init_name, dir_time, conn):
749
760
750
761
751
762
def run_client (server_addr , runtime , p_size , streams , init_name , dir_time ,
752
- protocol , conn , localpart ):
763
+ protocol , conn , localpart , tcpwin ):
753
764
p_size = bend_max_size (p_size , protocol )
754
765
repetitions , mod = divmod (runtime , 10 )
755
766
if not mod :
756
767
runtime += 1
757
768
758
769
iperf_args = ['-c' , server_addr , '-t' , str (runtime ), '-l' , str (p_size ),
759
770
'-P' , str (streams )]
760
- protocol_opts = set_protocol_opts (protocol )
771
+ protocol_opts = set_protocol_opts (protocol , tcpwin )
761
772
iperf_args += protocol_opts
762
773
iperf_command , output = conn .get_command (iperf_args , init_name + '_iperf_client.out' , init_name + '_iperf_client.err' )
763
774
source_name = conn .getname ()
@@ -813,7 +824,7 @@ def stop_server(conn, dir_time):
813
824
814
825
815
826
def run_tests (cl1_conn , cl2_conn , cl1_test_ip , cl2_test_ip , runtime , p_sizes ,
816
- streams , timestamp , test_title , protocol , export_dir ):
827
+ streams , timestamp , test_title , protocol , tcpwin , export_dir ):
817
828
series_time = str (timedelta (seconds = 2 * len (p_sizes ) * (runtime + 30 ) + 20 ))
818
829
print (time_header () + '\033 [92mStarting ' + protocol + ' tests.\033 [0m Expected run time: ' + series_time )
819
830
top_dir_name = timestamp + '_' + protocol + '_' + str (streams ) + '_st'
@@ -851,10 +862,10 @@ def run_tests(cl1_conn, cl2_conn, cl1_test_ip, cl2_test_ip, runtime, p_sizes,
851
862
combined_sumname = dir_time + '_' + direction + '_summary'
852
863
try :
853
864
print ('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++' )
854
- run_server (protocol , init_name , dir_time , server_conn )
865
+ run_server (protocol , init_name , dir_time , server_conn , tcpwin )
855
866
test_completed , repetitions = run_client (server_addr , runtime , p , streams ,
856
867
init_name , dir_time , protocol ,
857
- client_conn , localpart )
868
+ client_conn , localpart , tcpwin )
858
869
stop_server (server_conn , dir_time )
859
870
print ('Parsing results...' )
860
871
if localpart :
@@ -886,7 +897,8 @@ def run_tests(cl1_conn, cl2_conn, cl1_test_ip, cl2_test_ip, runtime, p_sizes,
886
897
mpstat_single_file , basename (init_name + '.png' ),
887
898
tot_iperf_mean , protocol , streams , print_unit , cl1_pretty_name ,
888
899
cl2_pretty_name , plot_type = 'singlesize' , direction = direction ,
889
- finished = test_completed , server_fault = server_fault , packet_size = p )
900
+ finished = test_completed , server_fault = server_fault ,
901
+ packet_size = p , tcpwin = tcpwin )
890
902
print ('Plotting...' )
891
903
pr = Popen ([gnuplot_bin , basename (init_name + '.plt' )], cwd = dirname (dir_time ))
892
904
pr .wait ()
@@ -916,7 +928,8 @@ def run_tests(cl1_conn, cl2_conn, cl1_test_ip, cl2_test_ip, runtime, p_sizes,
916
928
mpstat_ser_file , basename (combined_sumname + '.png' ),
917
929
tot_iperf_mean , protocol , streams , print_unit , cl1_pretty_name ,
918
930
cl2_pretty_name , plot_type = 'multisize' , direction = direction ,
919
- server_fault = np .array (iperf_tot )[:,0 ], packet_size = np .mean (p_sizes ))
931
+ server_fault = np .array (iperf_tot )[:,0 ], packet_size = np .mean (p_sizes ),
932
+ tcpwin = tcpwin )
920
933
pr = Popen ([gnuplot_bin , basename (combined_sumname + '.plt' )], cwd = dirname (dir_time ))
921
934
pr .wait ()
922
935
elif direction == 'one2two' :
@@ -930,25 +943,26 @@ def run_tests(cl1_conn, cl2_conn, cl1_test_ip, cl2_test_ip, runtime, p_sizes,
930
943
join (raw_data_subdir , common_filename + '_two2one_summary.png' ),
931
944
one2two_images , two2one_images , html_name , protocol , streams ,
932
945
all_one2two_failed , all_two2one_failed , print_unit , localpart ,
933
- cl1_pretty_name , cl2_pretty_name )
946
+ cl1_pretty_name , cl2_pretty_name , tcpwin )
934
947
935
948
936
949
def run_tests_for_protocols (cl1_conn , cl2_conn , cl1_test_ip , cl2_test_ip ,
937
950
runtime , p_sizes , streams , timestamp , test_title ,
938
- protocols , export_dir ):
951
+ protocols , tcpwin , export_dir ):
939
952
for p in protocols :
940
953
run_tests (cl1_conn , cl2_conn , cl1_test_ip , cl2_test_ip , runtime ,
941
- p_sizes , streams , timestamp , test_title , p , export_dir )
954
+ p_sizes , streams , timestamp , test_title , p , tcpwin ,
955
+ export_dir )
942
956
943
957
944
958
def run_tests_for_streams (cl1_conn , cl2_conn , cl1_test_ip , cl2_test_ip ,
945
959
runtime , p_sizes , streams , timestamp , test_title ,
946
- protocols , export_dir ):
960
+ protocols , tcpwin , export_dir ):
947
961
for s in streams :
948
962
if str (s ).isdigit ():
949
963
run_tests_for_protocols (cl1_conn , cl2_conn , cl1_test_ip ,
950
964
cl2_test_ip , runtime , p_sizes , s ,
951
- timestamp , test_title , protocols ,
965
+ timestamp , test_title , protocols , tcpwin ,
952
966
export_dir )
953
967
else :
954
968
print ('\033 [91mERROR:\033 [0m Can not test for ' + s +
@@ -973,7 +987,7 @@ def run_tests_for_streams(cl1_conn, cl2_conn, cl1_test_ip, cl2_test_ip,
973
987
# Run tests
974
988
run_tests_for_streams (cl1_conn , cl2_conn , cl1_test_ip , cl2_test_ip ,
975
989
run_duration , test_range , streams , rundate , title ,
976
- protocols , export_dir )
990
+ protocols , tcp_win_size , export_dir )
977
991
# Shut down the clients if needed.
978
992
# IF ONE OF THE CLIENTS IS LOCAL, IT WILL NOT SHUT DOWN.
979
993
if shutdown :
0 commit comments