Exemplo n.º 1
0
class MainTest(TestBase):
    def __init__(self, netperf_runtime, *args, **kargs):
        self.netperf_runtime = netperf_runtime
        super(MainTest, self).__init__(*args, **kargs)
        # self._stop_after_test = True

    def get_x_categories(self):
        return [
            # (65160, "65K"),
            (64 * 2**10, "64K"),
            (32 * 2**10, "32K"),
            (16 * 2**10, "16K"),
            # (8*2**10, "8K"),
            (4 * 2**10, "4K"),
            # (2*2**10, "2K"),
            (1 * 2**10, "1K"),
            # (512, "512"),
            (256, "256"),
            # (128, "128"),
            (64, "64"),
        ]

    def get_sensors(self):
        netperf_graph = Graph("msg size", "throughput",
                              r"../tmp/throughput.pdf",
                              r"../tmp/throughput.txt")
        self.netperf = NetPerfTCP(netperf_graph, runtime=self.netperf_runtime)

        packet_sensor = PacketNumberSensor(
            Graph("msg size", "packet number", r"../tmp/packet_num.pdf",
                  r"../tmp/packet_num.txt"),
            Graph("msg size", "average packet size", r"../tmp/packet_size.pdf",
                  r"../tmp/packet_size.txt"))

        interrupt_sensor = InterruptSensor(
            Graph("msg size", "interrupt count", r"../tmp/interrupts.pdf",
                  r"../tmp/interrupts.txt"))
        return [
            self.netperf,
            packet_sensor,
            interrupt_sensor,
        ]

    def get_vms(self):
        vms = []
        for i in range(1, 161, 20):
            vm = QemuE1000Max(disk_path=r"../vms/ubuntu-20.img",
                              guest_ip="10.10.0.43",
                              host_ip="10.10.0.44")
            vm.qemu_config["tx_packets_per_batch"] = i
            vm.qemu_config["no_mit_timer_on"] = 1
            vms.append((vm, i))

        return [(vm, "delay_{}".format(d)) for vm, d in vms]

    def test_func(self, vm: VM, vm_name: str, x_value: int):
        self.netperf.run_netperf(vm, vm_name, x_value, msg_size=x_value)
class MainTest(TestBase2VM):
    def __init__(self, netperf_runtime, *args, **kargs):
        self.netperf_runtime = netperf_runtime
        super(MainTest, self).__init__(*args, **kargs)

    def get_x_categories(self):
        return [
            # (65160, "65K"),
            (64 * 2**10, "64K"),
            (32 * 2**10, "32K"),
            (16 * 2**10, "16K"),
            (8 * 2**10, "8K"),
            (4 * 2**10, "4K"),
            (2 * 2**10, "2K"),
            (1 * 2**10, "1K"),
            (512, "512"),
            (256, "256"),
            (128, "128"),
            (64, "64"),
        ]

    def get_sensors(self):
        netperf_graph = Graph("msg size", "throughput",
                              r"/tmp/throughput_virtualbox_vm2vm.pdf",
                              r"/tmp/throughput_virtualbox_vm2vm.txt")
        self.netperf = NetPerfTCP(netperf_graph, runtime=self.netperf_runtime)

        # packet_sensor = PacketNumberSensor(
        #     Graph("msg size", "packet number", r"/tmp/packet_num.pdf", r"/tmp/packet_num.txt"),
        #     Graph("msg size", "average packet size", r"/tmp/packet_size.pdf", r"/tmp/packet_size.txt")
        # )
        return [self.netperf]  # , packet_sensor]

    def get_vms(self):
        virtualbox_e1000 = VirtualBox(r"e1000", "192.168.56.103",
                                      "192.168.56.1")
        virtualbox_e1000_1 = VirtualBox(r"e1000_cp", "192.168.56.101",
                                        "192.168.56.1")
        virtualbox_virtio = VirtualBox(r"virtio", "192.168.56.102",
                                       "192.168.56.1")
        virtualbox_virtio_1 = VirtualBox(r"virtio_cp", "192.168.56.104",
                                         "192.168.56.1")

        return [
            (virtualbox_e1000, virtualbox_e1000_1, "virtualbox_e1000"),
            (virtualbox_virtio, virtualbox_virtio_1, "virtualbox_virtio"),
        ]

    def test_func(self, vm: VM, vm_name: str, x_value: int, remote_ip=None):
        self.netperf.run_netperf(vm,
                                 vm_name,
                                 x_value,
                                 remote_ip=remote_ip,
                                 msg_size=x_value)
Exemplo n.º 3
0
class MainTest(TestBaseNetperf):
    def __init__(self, netperf_runtime, *args, **kargs):
        self.netperf_runtime = netperf_runtime
        super(MainTest, self).__init__(*args, **kargs)

    def get_x_categories(self):
        return [
            (65160, "65K"),
            (64 * 2**10, "64K"),
            (32 * 2**10, "32K"),
            (16 * 2**10, "16K"),
            (8 * 2**10, "8K"),
            (4 * 2**10, "4K"),
            (2 * 2**10, "2K"),
            (1 * 2**10, "1K"),
            (512, "512"),
            (256, "256"),
            (128, "128"),
            (64, "64"),
        ]

    def get_sensors(self):
        # netperf_graph = Graph("msg size", "throughput", r"/tmp/vmware-throughput.pdf", r"/tmp/vmware-throughput.txt")
        netperf_graph = Graph("msg size", "throughput",
                              r"/tmp/vmware-throughput.pdf",
                              r"/tmp/vmware-throughput.txt")
        self.netperf = NetPerfTCP(netperf_graph, runtime=self.netperf_runtime)

        # packet_sensor = PacketNumberSensor(
        #     Graph("msg size", "packet number", r"/tmp/packet_num.pdf", r"/tmp/packet_num.txt"),
        #     Graph("msg size", "average packet size", r"/tmp/packet_size.pdf", r"/tmp/packet_size.txt")
        # )
        return [self.netperf]  # , packet_sensor]

    def get_vms(self):
        vmware_e1000 = VMware(
            r"/homes/bdaviv/Shared\ VMs/Ubuntu\ Linux\ -\ e1000/Ubuntu\ Linux\ -\ e1000.vmx",
            "192.168.221.128", "192.168.221.1")
        vmware_para = VMware(
            r"/homes/bdaviv/Shared\ VMs/Ubuntu\ Linux\ -\ paravirtual_nic/Ubuntu\ Linux\ -\ paravirtual_nic.vmx",
            "192.168.221.129", "192.168.221.1")
        return [
            (vmware_e1000, "vmware_e1000"),
            (vmware_para, "vmware_paravirtual"),
        ]

    def test_func(self, vm: VM, vm_name: str, x_value: int):
        self.netperf.run_netperf(vm, vm_name, x_value, msg_size=x_value)
Exemplo n.º 4
0
def main(directory=None):
    trace_dir = get_dir(directory)

    shutil.copyfile(ORIG_QEMU, TMP_QEMU)
    os.makedirs(trace_dir, exist_ok=True)

    vm = QemuE1000Max(disk_path=r"../vms/ubuntu-20.img",
                      guest_ip="10.10.0.43",
                      host_ip="10.10.0.44")
    vm.qemu_config["latency_itr"] = 0
    vm.ethernet_dev = 'e1000-82545em'
    vm.addiotional_guest_command = 'sudo ethtool -C eth0 rx-usecs 3000'

    local_trace = Trace(localRoot, os.path.join(trace_dir, "trace_host"))
    local_trace.setup()

    # local_trace.enable_event("kvm/kvm_write_tsc_offset")
    # local_trace.enable_event("kvm/kvm_exit")
    # local_trace.enable_event("kvm/kvm_entry")
    # local_trace.enable_event("kvm/kvm_userspace_exit")

    # local_trace.set_event_filter("sched/sched_switch", r'prev_comm ~ "*qemu*" || next_comm ~ "*qemu*"')
    # local_trace.enable_event("sched/sched_switch")

    # objdump -tT /tmp/qemu-system-x86_64 |grep .text|grep virtio_queue_notify_vq
    ## local_trace.uprobe_add("p:virtio_queue_notify_vq /tmp/qemu-system-x86_64:0x1bfba6")
    # local_trace.uprobe_add_event("p", "virtio_queue_notify_vq", TMP_QEMU, "virtio_queue_notify_vq")
    # objdump -tT /tmp/qemu-system-x86_64 |grep .text|grep kvm_vcpu_ioctl
    ## local_trace.uprobe_add("p:kvm_vcpu_ioctl /tmp/qemu-system-x86_64:0x16a886 cmd=%si")
    # local_trace.uprobe_add_event("p", "kvm_vcpu_ioctl", TMP_QEMU, "kvm_vcpu_ioctl", "cmd=%si")
    # local_trace.uprobe_enable()

    # local_trace.empty_trace()
    # local_trace.trace_on()
    # local_trace.trace_to_local_file()

    vm.setup()
    vm.run()

    remote_trace = Trace(vm.root, os.path.join(trace_dir, "trace_guest"))
    remote_trace.setup()
    remote_trace.set_buffer_size(20000)
    remote_trace.enable_event("napi/napi_poll")
    # remote_trace.enable_event("power/cpu_idle")
    remote_trace.enable_event("irq/irq_handler_entry")
    # remote_trace.enable_event("e1000/e1000_pre_mem_op")
    # remote_trace.enable_event("e1000/e1000_post_mem_op")
    # remote_trace.enable_event("e1000/e1000_set_tdt")
    # remote_trace.enable_event("e1000/e1000_post_set_tdt")
    # remote_trace.kprobe_add("p:notify_begin vp_notify")
    # remote_trace.kprobe_add("r:notify_end vp_notify")
    # remote_trace.kprobe_enable()
    remote_trace.trace_on()

    netperf = NetPerfTCP(None, runtime=2)

    remote_trace.trace_marker(TRACE_BEGIN_MSG)
    netperf_perf = netperf.run_netperf(vm, msg_size="64K")
    remote_trace.trace_marker(TRACE_END_MSG)
    print("Netperf performance: %s" % (netperf_perf, ))
    logger.info("Netperf performance: %s", netperf_perf)

    remote_trace.trace_off()
    remote_trace.disable_all_events()
    local_trace.trace_off()
    local_trace.disable_all_events()

    netperf_perf = netperf.run_netperf(vm, msg_size="64K")
    print("Base Netperf performance: %s" % (netperf_perf,))
    logger.info("Base Netperf performance: %s", netperf_perf)

    remote_trace.read_trace_once(to_file=True)
    # local_trace.trace_to_local_file_stop()

    local_trace.disable_all_events()

    # input()
    vm.teardown()
Exemplo n.º 5
0
class MainTest(TestBaseNetperf):
    def __init__(self, netperf_runtime, *args, **kargs):
        self.netperf_runtime = netperf_runtime
        super(MainTest, self).__init__(*args, **kargs)

    def get_x_categories(self):
        return [
            (65160, "65K"),
            (64 * 2**10, "64K"),
            (32 * 2**10, "32K"),
            (16 * 2**10, "16K"),
            (8 * 2**10, "8K"),
            (4 * 2**10, "4K"),
            (2 * 2**10, "2K"),
            (1 * 2**10, "1K"),
            (512, "512"),
            (256, "256"),
            (128, "128"),
            (64, "64"),
        ]

    def get_sensors(self):
        netperf_graph = GraphGnuplot("msg size", "throughput",
                                     r"/tmp/throughput_1GB.pdf",
                                     r"/tmp/throughput_1GB.txt")
        self.netperf = NetPerfTCP(netperf_graph, runtime=self.netperf_runtime)

        # packet_sensor = PacketNumberSensor(
        #     Graph("msg size", "packet number", r"/tmp/packet_num.pdf", r"/tmp/packet_num.txt"),
        #     Graph("msg size", "average packet size", r"/tmp/packet_size.pdf", r"/tmp/packet_size.txt")
        # )
        return [self.netperf]  # , packet_sensor]

    def get_vms(self):
        virtualbox_e1000 = VirtualBox(r"e1000_1GB", "192.168.56.101",
                                      "192.168.56.1")
        virtualbox_virtio = VirtualBox(r"virtio_1GB", "192.168.56.102",
                                       "192.168.56.1")

        vmware_e1000 = VMware(
            r"/homes/bdaviv/Shared\ VMs/Ubuntu_Linux-e1000_1GB/Ubuntu\ Linux\ -\ e1000.vmx",
            "192.168.221.128", "192.168.221.1")
        vmware_para = VMware(
            r"/homes/bdaviv/Shared\ VMs/Ubuntu_Linux-para_1GB/Ubuntu\ Linux\ -\ paravirtual_nic.vmx",
            "192.168.221.129", "192.168.221.1")

        qemu_virtio = Qemu(disk_path=r"../vms/ubuntu-20.img",
                           guest_ip="10.10.0.43",
                           host_ip="10.10.0.44")
        qemu_virtio.ethernet_dev = Qemu.QEMU_VIRTIO
        qemu_virtio.mem = "1024"

        qemu_e1000 = Qemu(disk_path=r"../vms/ubuntu-20.img",
                          guest_ip="10.10.0.43",
                          host_ip="10.10.0.44")
        qemu_e1000.ethernet_dev = Qemu.QEMU_E1000
        qemu_e1000.mem = "1024"

        qemu_e1000_best = QemuE1000Max(disk_path=r"../vms/ubuntu-20.img",
                                       guest_ip="10.10.0.43",
                                       host_ip="10.10.0.44")
        qemu_e1000_best.mem = "1024"

        return [
            (virtualbox_e1000, "virtualbox_e1000"),
            (virtualbox_virtio, "virtualbox_virtio"),
            (vmware_e1000, "vmware_e1000"),
            (vmware_para, "vmware_para"),
            (qemu_virtio, "qemu_virtio"),
            (qemu_e1000, "qemu_e1000"),
            (qemu_e1000_best, "qemu_e1000_best"),
        ]

    def test_func(self, vm: VM, vm_name: str, x_value: int):
        self.netperf.run_netperf(vm, vm_name, x_value, msg_size=x_value)
Exemplo n.º 6
0
def main(directory=None, netperf_msg_size=None):
    trace_dir = get_dir(directory)

    if netperf_msg_size is None:
        netperf_msg_size = MSG_SIZE

    if ORIG_QEMU != TMP_QEMU:
        shutil.copyfile(ORIG_QEMU, TMP_QEMU)
    os.makedirs(trace_dir, exist_ok=True)

    netserver_start()
    logger.info("msg size = %s", netperf_msg_size)

    vm = QemuNG(disk_path=r"../vms/ubuntu-20.img",
                guest_ip="10.10.0.43",
                host_ip="10.10.0.44")
    vm.ethernet_dev = Qemu.QEMU_VIRTIO
    # vm.qemu_config["latency_itr"] = 0
    vm.e1000_options["NG_notify_batch"] = "on"
    vm.BOOTUP_WAIT = 15
    # vm.addiotional_guest_command = 'sudo ethtool -C eth0 rx-usecs 3000'

    local_trace = Trace(localRoot, os.path.join(trace_dir, "trace_host"))
    local_trace.setup()
    local_trace.set_buffer_size(100000)

    local_trace.enable_event("kvm/kvm_write_tsc_offset")
    # local_trace.enable_event("kvm/kvm_set_irq")
    # local_trace.enable_event("kvm/kvm_msi_set_irq")
    # local_trace.enable_event("kvm/kvm_inj_virq")
    # local_trace.enable_event("kvm/kvm_ioapic_set_irq")
    # local_trace.enable_event("kvm/kvm_exit")
    # local_trace.enable_event("kvm/kvm_entry")
    # local_trace.enable_event("kvm/kvm_userspace_exit")

    local_trace.set_event_filter(
        "sched/sched_switch", r'prev_comm ~ "*qemu*" || next_comm ~ "*qemu*"')
    # local_trace.enable_event("sched/sched_switch")

    local_trace.set_event_filter("sched/sched_wakeup", '\"comm~*qemu*\"')
    # local_trace.enable_event("sched/sched_wakeup")

    local_trace.set_event_filter("sched/sched_waking", '\"comm~*qemu*\"')
    # local_trace.enable_event("sched/sched_waking")

    # objdump -tT /tmp/qemu-system-x86_64 |grep .text|grep virtio_queue_notify_vq
    ## local_trace.uprobe_add("p:virtio_queue_notify_vq /tmp/qemu-system-x86_64:0x1bfba6")
    # local_trace.uprobe_add_event("p", "virtio_queue_notify_vq", TMP_QEMU, "virtio_queue_notify_vq")
    # objdump -tT /tmp/qemu-system-x86_64 |grep .text|grep kvm_vcpu_ioctl
    ## local_trace.uprobe_add("p:kvm_vcpu_ioctl /tmp/qemu-system-x86_64:0x16a886 cmd=%si")
    # local_trace.uprobe_add_event("p", "kvm_vcpu_ioctl", TMP_QEMU, "kvm_vcpu_ioctl", "cmd=%si")

    # local_trace.uprobe_add_event("p", "tap_write_packet", TMP_QEMU, "tap_write_packet")
    # local_trace.uprobe_add_event("p", "tap_recv_packets", TMP_QEMU, "tap_send")
    # local_trace.uprobe_add_event("r", "tap_recv_packets_end", TMP_QEMU, "tap_send")
    # local_trace.uprobe_add_event("p", "virtio_irq", TMP_QEMU, "virtio_irq")

    # local_trace.uprobe_add_event("p", "virtio_queue_notify_vq", TMP_QEMU, "virtio_queue_notify_vq")
    # local_trace.uprobe_add_event("p", "e1000_set_kick", TMP_QEMU, "e1000_set_kick")
    # local_trace.uprobe_add_event("p", "e1000_receive_batch_finished", TMP_QEMU, "e1000_receive_batch_finished")
    local_trace.uprobe_enable()

    local_trace.empty_trace()
    local_trace.trace_on()
    # local_trace.trace_to_local_file()

    vm.setup()
    vm.run()

    remote_trace = Trace(vm.root, os.path.join(trace_dir, "trace_guest"))
    remote_trace.setup()
    remote_trace.set_buffer_size(100000)
    # remote_trace.enable_event("tcp")
    # remote_trace.enable_event("net")
    # remote_trace.enable_event("irq")
    # remote_trace.enable_event("irq_vectors")
    # remote_trace.enable_event("napi")
    # remote_trace.enable_event("power/cpu_idle")
    # remote_trace.enable_event("syscalls/sys_enter_sendto")
    # remote_trace.enable_event("syscalls/sys_enter_recvfrom")
    remote_trace.enable_event("net/net_dev_xmit")

    # remote_trace.enable_event("irq/irq_handler_entry")
    # remote_trace.enable_event("e1000/e1000_pre_mem_op")
    # remote_trace.enable_event("e1000/e1000_post_mem_op")
    # remote_trace.enable_event("e1000/e1000_set_tdt")
    # remote_trace.enable_event("e1000/e1000_post_set_tdt")

    # remote_trace.kprobe_add("p:notify_begin virtqueue_kick")
    # remote_trace.kprobe_add("r:notify_end virtqueue_kick")

    # remote_trace.kprobe_enable()
    remote_trace.trace_on()

    netperf = NetPerfTCP(None, runtime=2)
    run_command_async("tcpdump -i tap0 -s 100 -w {} -W 1 -G 7".format(
        os.path.join(trace_dir, "virtio.cap")))
    remote_trace.trace_marker(TRACE_BEGIN_MSG)
    netperf_perf = netperf.run_netperf(vm, msg_size=netperf_msg_size)
    remote_trace.trace_marker(TRACE_END_MSG)
    print("Netperf performance: %s" % (netperf_perf, ))
    logger.info("Netperf performance: %s", netperf_perf)

    remote_trace.trace_off()
    remote_trace.disable_all_events()
    local_trace.trace_off()
    local_trace.disable_all_events()

    netperf_perf = netperf.run_netperf(vm, msg_size=netperf_msg_size)
    print("Base Netperf performance: %s" % (netperf_perf, ))
    logger.info("Base Netperf performance: %s", netperf_perf)

    local_trace.read_trace_once(to_file=True)
    remote_trace.read_trace_once(to_file=True)
    # local_trace.trace_to_local_file_stop()

    local_trace.disable_all_events()

    # input("Press Enter to exit")
    vm.teardown()
    netserver_stop()
class MainTest(TestBase):
    def __init__(self, netperf_runtime, *args, **kargs):
        super(MainTest, self).__init__(*args, **kargs)

    def get_x_categories(self):
        return [
                # (65160, "65K"),
                # (64*2**10, "64K"),
                # (32*2**10, "32K"),
                # (16*2**10, "16K"),
                # (8*2**10, "8K"),
                (4*2**10, "4K"),
                # (2*2**10, "2K"),
                (1*2**10, "1K"),
                # (512, "512"),
                # (256, "256"),
                # (128, "128"),
                (64, "64"),
                ]

    def get_runtimes(self):
        return [
            2, 4, 8, 16, 32, 64
        ]

    def get_sensors(self):
        netperf_graph = GraphErrorBars("runtime", "throughput", r"/tmp/runtime.pdf", r"/tmp/runtime.txt")
        self.netperf = NetPerfTCP(netperf_graph, runtime=0)

        # packet_sensor = PacketNumberSensor(
        #     Graph("msg size", "packet number", r"/tmp/packet_num.pdf", r"/tmp/packet_num.txt"),
        #     Graph("msg size", "average packet size", r"/tmp/packet_size.pdf", r"/tmp/packet_size.txt")
        # )
        return [self.netperf] # , packet_sensor]

    def get_vms(self):
        qemu_virtio = Qemu(disk_path=r"../vms/ubuntu-20.img",
                           guest_ip="10.10.0.43",
                           host_ip="10.10.0.44")
        qemu_virtio.ethernet_dev = Qemu.QEMU_VIRTIO

        return [
            (qemu_virtio, "qemu_virtio"),
        ]

    def test_func(self, vm: VM, msg_size_name: str, runtime: int, x_value):
        self.netperf.runtime = runtime
        self.netperf.run_netperf(vm, msg_size_name, x_value, msg_size=x_value)

    def pre_run(self):
        for sensor in self._sensors:
            sensor.set_column_names([msg_size_name for _, msg_size_name in self._x_categories])
            sensor.set_x_tics(labels=[str(times) for times in self.get_runtimes()],
                              values=[times for times in self.get_runtimes()])

    def run(self):
        for vm, vm_name in self._vms:
            vm.setup()
            vm.run()

            for msg_size, msg_size_name in self._x_categories:
                for runtime in self.get_runtimes():
                    for i in range(self._retries):
                        for sensor in self._sensors:
                            sensor.test_before(vm)

                        logger.info("Runing msg_size=%s, runtime=%s", msg_size_name, runtime)
                        self.test_func(vm, msg_size_name, runtime, msg_size)

                        for sensor in self._sensors:
                            sensor.test_after(vm, msg_size_name, runtime)

            vm.teardown()
Exemplo n.º 8
0
class QemuRegularTest(TestBaseNetperf):
    DIR = r"../tmp/results"

    def __init__(self, netperf_runtime, *args, **kargs):
        self.netperf_runtime = netperf_runtime
        super(QemuRegularTest, self).__init__(*args, **kargs)
        # self._stop_after_test = True

    def get_x_categories(self):
        return [
            (64, "64"),
            # (128, "128"),
            (256, "256"),
            # (512, "512"),
            (1 * 2 ** 10, "1K"),
            # (2 * 2 ** 10, "2K"),
            (4 * 2 ** 10, "4K"),
            # (8 * 2 ** 10, "8K"),
            (16 * 2 ** 10, "16K"),
            # (32 * 2 ** 10, "32K"),
            (64 * 2 ** 10, "64K"),
        ]

    def get_sensors(self):
        netperf_graph = GraphErrorBarsGnuplot("msg size", "throughput",
                                              path.join(self.DIR, "throughput"),
                                              graph_title="Throughput")
        self.netperf = NetPerfTCP(netperf_graph, runtime=self.netperf_runtime)

        # packet_sensor = PacketNumberSensor(
        #     Graph("msg size", "packet number", r"../tmp/packet_num.pdf", r"../tmp/packet_num.txt"),
        #     Graph("msg size", "average packet size", r"../tmp/packet_size.pdf", r"../tmp/packet_size.txt")
        # )

        packet_sensor_tx_bytes = PacketRxBytesSensor(
            Graph("msg size", "Total TX size",
                  path.join(self.DIR, "throughput-tx_bytes"),
                  normalize=self.netperf_runtime
                  )
        )
        packet_sensor_tx_packets = PacketRxPacketsSensor(
            Graph("msg size", "Total TX packets",
                  path.join(self.DIR, "throughput-tx_packets"),
                  normalize=self.netperf_runtime)
        )

        packet_sensor_avg_size = DummySensor(
            RatioGraph(packet_sensor_tx_bytes.graph, packet_sensor_tx_packets.graph,
                       "msg size", "TX Packet Size",
                       path.join(self.DIR, "throughput-tx_packet_size")
                       )
        )

        interrupt_sensor = InterruptSensor(
            Graph("msg size", "interrupt count (per sec)",
                  path.join(self.DIR, "throughput-interrupts"),
                  normalize=self.netperf_runtime)
        )

        kvm_exits = KvmExitsSensor(
            Graph("msg size", "exits count (per sec)",
                  path.join(self.DIR, "throughput-kvm_exits"),
                  normalize=self.netperf_runtime)
        )

        kvm_exits_ratio = DummySensor(
            RatioGraph(kvm_exits.graph, packet_sensor_tx_packets.graph,
                       "msg size", "Exits per Packet",
                       path.join(self.DIR, "throughput-kvm_exits-ratio")
                       )
        )

        interrupt_ratio = DummySensor(
            RatioGraph(interrupt_sensor.graph, packet_sensor_tx_packets.graph,
                       "msg size", "Interrupts per Packet",
                       path.join(self.DIR, "throughput-interrupts-ratio")
                       )
        )

        kvm_halt_exits = KvmHaltExitsSensor(
            GraphErrorBarsGnuplot("msg size", "Halt exits count (per sec)",
                                  path.join(self.DIR, "throughput-kvm_halt_exits"),
                                  normalize=self.netperf_runtime)
        )

        batch_size = QemuBatchSizeSensor(
            Graph("msg size", "Average batch size (in packets)",
                  path.join(self.DIR, "throughput-batch_size"))
        )

        batch_descriptos_size = QemuBatchDescriptorsSizeSensor(
            Graph("msg size", "Average batch size (in descriptors)",
                  path.join(self.DIR, "throughput-batch_descriptors_size"))
        )

        batch_count = QemuBatchCountSensor(
            Graph("msg size", "Average batch Count (per Sec)",
                  path.join(self.DIR, "throughput-batch_count"),
                  normalize=self.netperf_runtime)
        )

        batch_halt_ratio = DummySensor(
            RatioGraph(batch_count.graph, kvm_halt_exits.graph,
                       "msg size", "batch count / kvm halt",
                       path.join(self.DIR, "throughtput-batchCount_kvmHalt"))
        )

        cpu_sensors = get_all_cpu_sensors(self.DIR, "throughput", self.netperf_runtime)

        return [
                   self.netperf,
                   packet_sensor_tx_bytes,
                   packet_sensor_tx_packets,
                   packet_sensor_avg_size,

                   interrupt_sensor,
                   kvm_exits,

                   kvm_exits_ratio,
                   kvm_halt_exits,

                   interrupt_ratio,

                   batch_size,
                   batch_descriptos_size,
                   batch_count,
                   batch_halt_ratio,

               ] + cpu_sensors

    def get_vms(self):
        qemu_virtio = Qemu(disk_path=r"../vms/ubuntu-20.img",
                           guest_ip="10.10.0.43",
                           host_ip="10.10.0.44")
        qemu_virtio.ethernet_dev = Qemu.QEMU_VIRTIO

        qemu_virtio_latency = Qemu(disk_path=r"../vms/ubuntu-20.img",
                                   guest_ip="10.10.0.43",
                                   host_ip="10.10.0.44")
        qemu_virtio_latency.ethernet_dev = Qemu.QEMU_VIRTIO
        qemu_virtio_latency.qemu_config["latency_itr"] = 2

        qemu_e1000_baseline = Qemu(disk_path=r"../vms/ubuntu-20.img",
                                   guest_ip="10.10.0.43",
                                   host_ip="10.10.0.44")
        qemu_e1000_baseline.ethernet_dev = Qemu.QEMU_E1000

        qemu_e1000_arthur = QemuE1000Max(disk_path=r"../vms/ubuntu-20.img",
                                         guest_ip="10.10.0.43",
                                         host_ip="10.10.0.44")
        qemu_e1000_arthur.qemu_config["latency_itr"] = 0
        qemu_e1000_arthur.is_io_thread_nice = False

        qemu_e1000_arthur_nice = QemuE1000Max(disk_path=r"../vms/ubuntu-20.img",
                                         guest_ip="10.10.0.43",
                                         host_ip="10.10.0.44")
        qemu_e1000_arthur_nice.qemu_config["latency_itr"] = 0


        qemu_large_queue = QemuLargeRing(disk_path=r"../vms/ubuntu-20.img",
                               guest_ip="10.10.0.43",
                               host_ip="10.10.0.44")
        qemu_large_queue.is_io_thread_nice = True

        qemu_large_queue_itr = list()
        for i in range(500, 1600, 100):
            for nice in (True, ):
                v = QemuLargeRing(disk_path=r"../vms/ubuntu-20.img",
                                 guest_ip="10.10.0.43",
                                 host_ip="10.10.0.44")
                v.is_io_thread_nice = nice
                v.qemu_config["interrupt_mitigation_multiplier"] = i
                v.qemu_config["drop_packet_every"] = 0
                v.qemu_config["interrupt_mode"] = 1
                qemu_large_queue_itr.append((v, "qemu_large_queueu_%s_itr_%d" % (["no_nice", "nice"][nice], i,)))

        return [
            # (qemu_virtio, "virtio-net_baseline"),
            # (qemu_e1000_baseline, "e1000_baseline"),

            # (qemu_e1000_arthur, "e1000_10x_arthur"),
            # (qemu_large_queue, "qemu_large_queue"),
        ] + qemu_large_queue_itr

    def test_func(self, vm: VM, vm_name: str, x_value: int):
        self.netperf.run_netperf(vm, vm_name, x_value, msg_size=x_value)
Exemplo n.º 9
0
class MainTest(TestBaseNetperf):
    def __init__(self, netperf_runtime, *args, **kargs):
        self.netperf_runtime = netperf_runtime
        super(MainTest, self).__init__(*args, **kargs)

    def get_x_categories(self):
        return [
            # (65160, "65K"),
            (64 * 2**10, "64K"),
            (32 * 2**10, "32K"),
            (16 * 2**10, "16K"),
            (8 * 2**10, "8K"),
            (4 * 2**10, "4K"),
            (2 * 2**10, "2K"),
            (1 * 2**10, "1K"),
            (512, "512"),
            (256, "256"),
            (128, "128"),
            (64, "64"),
        ]

    def get_sensors(self):
        netperf_graph = Graph("msg size", "throughput",
                              r"/tmp/throughput_2cpu.pdf",
                              r"/tmp/throughput_2cpu.txt")
        self.netperf = NetPerfTCP(netperf_graph, runtime=self.netperf_runtime)

        packet_sensor = PacketNumberSensor(
            Graph("msg size", "packet number", r"/tmp/packet_num_2cpu.pdf",
                  r"/tmp/packet_num_2cpu.txt"),
            Graph("msg size", "average packet size",
                  r"/tmp/packet_size_2cpu.pdf", r"/tmp/packet_size_2cpu.txt"))
        return [self.netperf, packet_sensor]

    def get_vms(self):
        qemu_virtio = Qemu(disk_path=r"../vms/ubuntu-20.img",
                           guest_ip="10.10.0.43",
                           host_ip="10.10.0.44")
        qemu_virtio.ethernet_dev = Qemu.QEMU_VIRTIO
        qemu_virtio.io_thread_cpu = "1"

        qemu_e1000 = Qemu(disk_path=r"../vms/ubuntu-20.img",
                          guest_ip="10.10.0.43",
                          host_ip="10.10.0.44")
        qemu_e1000.ethernet_dev = Qemu.QEMU_E1000
        qemu_e1000.io_thread_cpu = "1"

        qemu_e1000_best = QemuE1000Max(disk_path=r"../vms/ubuntu-20.img",
                                       guest_ip="10.10.0.43",
                                       host_ip="10.10.0.44")
        qemu_e1000_best.io_thread_cpu = "1"

        # self.qemu_virtio_1g = Qemu(disk_path=r"../vms/ubuntu-20.img",
        #                            guest_ip="10.10.0.43",
        #                            host_ip="10.10.0.44")
        # self.qemu_virtio_1g.ethernet_dev = Qemu.QEMU_VIRTIO
        # self.qemu_virtio_1g.mem=1024
        #
        # self.qemu_e1000_1g = Qemu(disk_path=r"../vms/ubuntu-20.img",
        #                           guest_ip="10.10.0.43",
        #                           host_ip="10.10.0.44")
        # self.qemu_e1000_1g.ethernet_dev = Qemu.QEMU_E1000
        # self.qemu_e1000_1g.mem=1024

        return [
            (qemu_virtio, "qemu_virtio_base"),
            (qemu_e1000, "qemu_e1000_base"),
            (qemu_e1000_best, "qemu_e1000"),
            # (self.qemu_virtio_1g, "qemu_virtio_1G"),
            # (self.qemu_e1000_1g, "qemu_e1000_1G"),
        ]

    def test_func(self, vm: VM, vm_name: str, x_value: int):
        self.netperf.run_netperf(vm, vm_name, x_value, msg_size=x_value)
Exemplo n.º 10
0
class MainTest(TestBase2VM):
    def __init__(self, netperf_runtime, *args, **kargs):
        self.netperf_runtime = netperf_runtime
        super(MainTest, self).__init__(*args, **kargs)

    def get_x_categories(self):
        return [
            # (65160, "65K"),
            (64 * 2 ** 10, "64K"),
            (32 * 2 ** 10, "32K"),
            (16 * 2 ** 10, "16K"),
            (8 * 2 ** 10, "8K"),
            (4 * 2 ** 10, "4K"),
            (2 * 2 ** 10, "2K"),
            (1 * 2 ** 10, "1K"),
            (512, "512"),
            (256, "256"),
            (128, "128"),
            (64, "64"),
        ]

    def get_sensors(self):
        netperf_graph = Graph("msg size", "throughput", r"/tmp/throughput_qemu_vm2vm.pdf",
                              r"/tmp/throughput_qemu_vm2vm.txt")
        self.netperf = NetPerfTCP(netperf_graph, runtime=self.netperf_runtime)

        packet_sensor = PacketNumberSensor(
            Graph("msg size", "packet number", r"/tmp/packet_num_vm2vm.pdf", r"/tmp/packet_num_vm2vm.txt"),
            Graph("msg size", "average packet size", r"/tmp/packet_size_vm2vm.pdf", r"/tmp/packet_size_vm2vm.txt")
        )
        return [self.netperf, packet_sensor]

    def test_func(self, vm: VM, vm_name: str, x_value: int, remote_ip=None):
        self.netperf.run_netperf(vm, vm_name, x_value, remote_ip=remote_ip, msg_size=x_value)

    def get_vms(self):
        qemu_virtio1 = Qemu(disk_path=r"../vms/ubuntu-20.img",
                            guest_ip="10.10.0.43",
                            host_ip="10.10.0.44")
        qemu_virtio1.ethernet_dev = Qemu.QEMU_VIRTIO
        qemu_virtio2 = Qemu(disk_path=r"../vms/vm-copy.img",
                            guest_ip="10.10.0.42",
                            host_ip="10.10.0.44")
        qemu_virtio2.vnc_number = 11
        qemu_virtio2.ethernet_dev = Qemu.QEMU_VIRTIO
        qemu_virtio2.mac_address = "52:54:00:a0:e5:1d"
        qemu_virtio2.cpu_to_pin = 3

        qemu_e1000_1 = Qemu(disk_path=r"../vms/ubuntu-20.img",
                            guest_ip="10.10.0.43",
                            host_ip="10.10.0.44")
        qemu_e1000_1.ethernet_dev = Qemu.QEMU_E1000
        qemu_e1000_2 = Qemu(disk_path=r"../vms/vm-copy.img",
                            guest_ip="10.10.0.42",
                            host_ip="10.10.0.44")
        qemu_e1000_2.ethernet_dev = Qemu.QEMU_E1000
        qemu_e1000_2.vnc_number = 11
        qemu_e1000_2.mac_address = "52:54:00:a0:e5:1d"
        qemu_e1000_2.cpu_to_pin = 3

        qemu_e1000_best1 = QemuE1000GuestOnly(disk_path=r"../vms/ubuntu-20.img",
                                              guest_ip="10.10.0.43",
                                              host_ip="10.10.0.44")
        qemu_e1000_best2 = QemuE1000GuestOnly(disk_path=r"../vms/vm-copy.img",
                                              guest_ip="10.10.0.42",
                                              host_ip="10.10.0.44")
        qemu_e1000_best2.vnc_number = 11
        qemu_e1000_best2.mac_address = "52:54:00:a0:e5:1d"
        qemu_e1000_best2.cpu_to_pin = 3

        for vm in (qemu_virtio1, qemu_virtio2, qemu_e1000_1, qemu_e1000_2, qemu_e1000_best1,
                   qemu_e1000_best2):
            vm.bridge = "br-vms"
            # vm.cpu_to_pin = "0-3"

        return [
            (qemu_e1000_1, qemu_e1000_2, "qemu_e1000_base"),
            (qemu_virtio1, qemu_virtio2, "qemu_virtio_base"),
            (qemu_e1000_best1, qemu_e1000_best2, "qemu_e1000_tcp_checksum"),
        ]

    def configure_bride(self):
        run_command("sudo brctl addbr br-vms")
        run_command("sudo  ip link set {tap} up".format(tap="br-vms"))
        run_command("sudo ip a a {host_ip}/24 dev {tap}".format(host_ip="10.10.0.44",
                                                                tap="br-vms"))

    def teardown_bridge(self):
        run_command_check("sudo  ip link set {tap} down".format(tap="br-vms"))
        run_command_check("sudo brctl delbr br-vms")