5555flags .DEFINE_integer (
5656 'netperf_warmup_test_length' ,
5757 60 ,
58- 'The duration of the warmup run in seconds. If --netperf_benchmarks'
59- ' contains TCP_RR, a warmup run of this duration will be performed before'
60- ' the benchmark runs. If 0, no warmup is done.' ,
58+ 'The duration of the warmup run in seconds. If greater than 0, a warmup '
59+ 'run of this duration will be performed before each benchmark run.' ,
6160 lower_bound = 0 ,
6261)
6362flags .DEFINE_bool (
@@ -241,13 +240,6 @@ def Prepare(benchmark_spec):
241240 ],
242241 2 ,
243242 )
244- if (
245- TCP_RR in FLAGS .netperf_benchmarks
246- and FLAGS .netperf_warmup_test_length > 0
247- ):
248- # If TCP_RR is requested, do a warmup run as 1st run performance could be
249- # low due to initial flow setup issue.
250- RunClientServerVMs (client_vm , server_vm , FLAGS .netperf_warmup_test_length )
251243
252244
253245def PrepareClientVM (client_vm ):
@@ -526,12 +518,8 @@ def RunNetperf(
526518 'netperf_test_length' : test_length ,
527519 'sending_thread_count' : num_streams ,
528520 'max_iter' : FLAGS .netperf_max_iter or 1 ,
521+ 'netperf_warmup_test_length' : FLAGS .netperf_warmup_test_length ,
529522 }
530- if (
531- TCP_RR in FLAGS .netperf_benchmarks
532- and FLAGS .netperf_warmup_test_length > 0
533- ):
534- metadata ['netperf_warmup_test_length' ] = FLAGS .netperf_warmup_test_length
535523
536524 remote_cmd_list = []
537525 assert server_ips , 'Server VM does not have an IP to use for netperf.'
@@ -803,6 +791,20 @@ def RunClientServerVMs(client_vm, server_vm, test_length=None):
803791
804792 for netperf_benchmark in FLAGS .netperf_benchmarks :
805793 if vm_util .ShouldRunOnExternalIpAddress ():
794+ if FLAGS .netperf_warmup_test_length > 0 :
795+ logging .info (
796+ 'Running warmup for %s for %d seconds' ,
797+ netperf_benchmark ,
798+ FLAGS .netperf_warmup_test_length ,
799+ )
800+ RunNetperf (
801+ client_vm ,
802+ netperf_benchmark ,
803+ server_vm .GetExternalIPs (),
804+ num_streams ,
805+ [client_vm .GetInternalIPs ()[0 ]],
806+ FLAGS .netperf_warmup_test_length ,
807+ )
806808 external_ip_results = RunNetperf (
807809 client_vm ,
808810 netperf_benchmark ,
@@ -821,6 +823,20 @@ def RunClientServerVMs(client_vm, server_vm, test_length=None):
821823 results .extend (external_ip_results )
822824
823825 if vm_util .ShouldRunOnInternalIpAddress (client_vm , server_vm ):
826+ if FLAGS .netperf_warmup_test_length > 0 :
827+ logging .info (
828+ 'Running warmup for %s for %d seconds' ,
829+ netperf_benchmark ,
830+ FLAGS .netperf_warmup_test_length ,
831+ )
832+ RunNetperf (
833+ client_vm ,
834+ netperf_benchmark ,
835+ server_vm .GetInternalIPs (),
836+ num_streams ,
837+ client_vm .GetInternalIPs (),
838+ FLAGS .netperf_warmup_test_length ,
839+ )
824840 internal_ip_results = RunNetperf (
825841 client_vm ,
826842 netperf_benchmark ,
0 commit comments