Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#2187 from SMU-ATT-Center-for-V…
Browse files Browse the repository at this point in the history
…irtualization:iperf_sending_threads

PiperOrigin-RevId: 305766100
  • Loading branch information
copybara-github committed Apr 9, 2020
2 parents 65aa5d5 + 6426c00 commit ac39978
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions perfkitbenchmarker/linux_benchmarks/iperf_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import re

from perfkitbenchmarker import configs
from perfkitbenchmarker import flag_util
from perfkitbenchmarker import flags
from perfkitbenchmarker import sample
from perfkitbenchmarker import vm_util
from perfkitbenchmarker import flag_util

flag_util.DEFINE_integerlist('iperf_sending_thread_count',
flag_util.IntegerList([1]),
Expand Down Expand Up @@ -88,13 +88,15 @@ def Prepare(benchmark_spec):


@vm_util.Retry(max_retries=IPERF_RETRIES)
def _RunIperf(sending_vm, receiving_vm, receiving_ip_address, thread_count, ip_type):
def _RunIperf(sending_vm, receiving_vm, receiving_ip_address, thread_count,
ip_type):
"""Run iperf using sending 'vm' to connect to 'ip_address'.
Args:
sending_vm: The VM sending traffic.
receiving_vm: The VM receiving traffic.
receiving_ip_address: The IP address of the iperf server (ie the receiver).
thread_count: The number of threads the server will use.
ip_type: The IP type of 'ip_address' (e.g. 'internal', 'external')
Returns:
A Sample.
Expand Down Expand Up @@ -131,7 +133,7 @@ def _RunIperf(sending_vm, receiving_vm, receiving_ip_address, thread_count, ip_t
# If there is no sum you have try and figure out an estimate
# which happens when threads start at different times. The code
# below will tend to overestimate a bit.
thread_values = re.findall('\[.*\d+\].*\s+(\d+\.?\d*).Mbits/sec', stdout)
thread_values = re.findall(r'\[.*\d+\].*\s+(\d+\.?\d*).Mbits/sec', stdout)

if len(thread_values) != thread_count:
raise ValueError('Only %s out of %s iperf threads reported a'
Expand Down

0 comments on commit ac39978

Please sign in to comment.