Skip to content

Commit f917fcb

Browse files
andyz422copybara-github
authored andcommitted
Aggregate TCP retransmission counts for multiple TCP streams in netperf benchmark.
PiperOrigin-RevId: 903536281
1 parent 0fd7618 commit f917fcb

1 file changed

Lines changed: 23 additions & 10 deletions

File tree

perfkitbenchmarker/linux_benchmarks/netperf_benchmark.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,29 @@ def RunNetperf(vm, benchmark_name, server_ips, num_streams, client_ips):
662662
)
663663
# They should all have the same units
664664
throughput_unit = throughput_samples[0].unit
665+
666+
if 'TCP' in benchmark_name.upper():
667+
netperf_retransmissions = 0
668+
netserver_retransmissions = 0
669+
netperf_mss = None
670+
for throughput_sample in throughput_samples:
671+
netperf_retransmissions += int(
672+
throughput_sample.metadata['netperf_retransmissions']
673+
)
674+
netserver_retransmissions += int(
675+
throughput_sample.metadata['netserver_retransmissions']
676+
)
677+
sample_netperf_mss = throughput_sample.metadata['netperf_mss']
678+
if netperf_mss is None:
679+
netperf_mss = sample_netperf_mss
680+
elif netperf_mss != sample_netperf_mss:
681+
raise ValueError(
682+
'Netperf MSS values do not match for multiple netperf threads.'
683+
)
684+
metadata['netperf_retransmissions'] = netperf_retransmissions
685+
metadata['netserver_retransmissions'] = netserver_retransmissions
686+
metadata['netperf_mss'] = netperf_mss if netperf_mss else 'unknown'
687+
665688
# Extract the throughput values from the samples
666689
throughputs = [s.value for s in throughput_samples]
667690
# Compute some stats on the throughput values
@@ -683,16 +706,6 @@ def RunNetperf(vm, benchmark_name, server_ips, num_streams, client_ips):
683706
# Create formatted output, following {benchmark_name}_Throughput_Xstream(s)
684707
# for TCP stream throughput metrics
685708
if benchmark_name.upper() == 'TCP_STREAM':
686-
netperf_mss = None
687-
for throughput_sample in throughput_samples:
688-
sample_netperf_mss = throughput_sample.metadata['netperf_mss']
689-
if netperf_mss is None:
690-
netperf_mss = sample_netperf_mss
691-
elif netperf_mss != sample_netperf_mss:
692-
raise ValueError(
693-
'Netperf MSS values do not match for multiple netperf threads.'
694-
)
695-
metadata['netperf_mss'] = netperf_mss if netperf_mss else 'unknown'
696709
samples.append(
697710
sample.Sample(
698711
f'{benchmark_name}_Throughput_{len(parsed_output)}streams',

0 commit comments

Comments
 (0)