Ejemplo n.º 1
0
def Run(benchmark_spec):
    """Measure TCP stream throughput between two VMs.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.

  Returns:
    A list of sample.Sample objects with the benchmark results.
  """

    vms = benchmark_spec.vms
    results = []

    # Send traffic in both directions
    for originator in [0, 1]:
        sending_vm = vms[originator]
        receiving_vm = vms[originator ^ 1]
        # Send using external IP addresses
        if vm_util.ShouldRunOnExternalIpAddress():
            results.extend(
                ntttcp.RunNtttcp(sending_vm, receiving_vm,
                                 receiving_vm.ip_address, 'external'))

        # Send using internal IP addresses
        if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm):
            results.extend(
                ntttcp.RunNtttcp(sending_vm, receiving_vm,
                                 receiving_vm.internal_ip, 'internal'))
    return results
Ejemplo n.º 2
0
def _RunTest(benchmark_spec, sender, receiver, dest_ip, ip_type, conf,
             cooldown_s):
    """Run a single NTTTCP test, and publish the results."""
    try:
        results = ntttcp.RunNtttcp(sender, receiver, dest_ip, ip_type,
                                   conf.udp, conf.threads, conf.time_s,
                                   conf.packet_size, cooldown_s)
        publisher.PublishRunStageSamples(benchmark_spec, results)
        return True
    except IOError:
        logging.info('Failed to publish %s IP results for config %s', ip_type,
                     str(conf))
        return False