|
| 1 | +# import pandas |
| 2 | +# import re |
| 3 | +# from framework.microvm import MicroVMFactory |
| 4 | +# |
| 5 | +# KERNEL = "vmlinux-5.10.221" |
| 6 | +# ROOTFS = "ubuntu-22.04.ext4" |
| 7 | +# |
| 8 | +# |
| 9 | +# def run_tests(): |
| 10 | +# factory = MicrovmFactory(fc_binary_path, jailer_binary_path) |
| 11 | +# manual_data = test_manual_latency(factory) |
| 12 | +# manual_data.to_csv("~/dev/results/manual_hotplug_data.csv") |
| 13 | +# |
| 14 | +# def test_manual_latency(microvm_factory): |
| 15 | +# """Test the latency for hotplugging and booting CPUs in the guest""" |
| 16 | +# fc_binary_path, jailer_binary_path = build_tools.get_firecracker_binaries() |
| 17 | +# df = pandas.DataFrame(columns=["vcpus", "api", "onlining"]) |
| 18 | +# gcc_compile(Path("./hotplug_time.c"), Path("./hotplug_time.o")) |
| 19 | +# data = [] |
| 20 | +# for vcpu_count in range(2, 30, 2): |
| 21 | +# for i in range(50): |
| 22 | +# uvm_hotplug = microvm_factory.build(KERNEL, ROOTFS) |
| 23 | +# uvm_hotplug.jailer.extra_args.update({"boot-timer": None, "no-seccomp": None}) |
| 24 | +# uvm_hotplug.help.enable_console() |
| 25 | +# uvm_hotplug.spawn() |
| 26 | +# uvm_hotplug.basic_config(vcpu_count=1, mem_size_mib=128) |
| 27 | +# uvm_hotplug.add_net_iface() |
| 28 | +# uvm_hotplug.start() |
| 29 | +# uvm_hotplug.ssh.scp_put(Path("./host_tools/hotplug.sh"), Path("/home/hotplug.sh")) |
| 30 | +# uvm_hotplug.ssh.scp_put(Path("./host_tools//hotplug_time.o"), Path("/home/hotplug_time.o")) |
| 31 | +# uvm_hotplug.ssh.run("tmux new-session -d /bin/bash /home/hotplug.sh > /home/test 2>&1") |
| 32 | +# |
| 33 | +# |
| 34 | +# uvm_hotplug.api.hotplug.put(Vcpu={"add": vcpu_count}) |
| 35 | +# |
| 36 | +# time.sleep(0.25) |
| 37 | +# # Extract API call duration |
| 38 | +# api_duration = float(re.findall(r"Total previous API call duration: (\d+) us\.", uvm_hotplug.log_data)[-1]) / 1000 |
| 39 | +# timestamp = float(re.findall(r"Guest-boot-time\s+\=\s+(\d+)\s+us", uvm_hotplug.log_data)[0]) / 1000 |
| 40 | +# data.append({"vcpus" : vcpu_count, "api": api_duration, "onlining": timestamp}) |
| 41 | +# return pandas.DataFrame.from_dict(data) |
| 42 | + |
| 43 | +# def test_custom_udev_latency(): |
| 44 | +# """Test the latency for hotplugging and booting CPUs in the guest""" |
| 45 | +# fc_binary_path, jailer_binary_path = build_tools.get_firecracker_binaries() |
| 46 | +# df = pandas.DataFrame(columns=["vcpus", "api", "onlining"]) |
| 47 | +# gcc_compile(Path("./hotplug_time.c"), Path("./hotplug_time.o")) |
| 48 | +# data = [] |
| 49 | +# for vcpu_count in range(2, 30, 2): |
| 50 | +# for i in range(50): |
| 51 | +# uvm_hotplug = microvm_factory.build(KERNEL, ROOTFS) |
| 52 | +# uvm_hotplug.jailer.extra_args.update({"boot-timer": None, "no-seccomp": None}) |
| 53 | +# uvm_hotplug.help.enable_console() |
| 54 | +# uvm_hotplug.spawn() |
| 55 | +# uvm_hotplug.basic_config(vcpu_count=1, mem_size_mib=128) |
| 56 | +# uvm_hotplug.add_net_iface() |
| 57 | +# uvm_hotplug.start() |
| 58 | +# uvm_hotplug.ssh.scp_put(Path("./host_tools/hotplug.sh"), Path("/home/hotplug.sh")) |
| 59 | +# uvm_hotplug.ssh.scp_put(Path("./host_tools//hotplug_time.o"), Path("/home/hotplug_time.o")) |
| 60 | +# uvm_hotplug.ssh.run("tmux new-session -d /bin/bash /home/hotplug.sh > /home/test 2>&1") |
| 61 | +# |
| 62 | +# |
| 63 | +# uvm_hotplug.api.hotplug.put(Vcpu={"add": vcpu_count}) |
| 64 | +# |
| 65 | +# time.sleep(0.25) |
| 66 | +# # Extract API call duration |
| 67 | +# api_duration = float(re.findall(r"Total previous API call duration: (\d+) us\.", uvm_hotplug.log_data)[-1]) / 1000 |
| 68 | +# timestamp = float(re.findall(r"Guest-boot-time\s+\=\s+(\d+)\s+us", uvm_hotplug.log_data)[0]) / 1000 |
| 69 | +# data.append({"vcpus" : vcpu_count, "api": api_duration, "onlining": timestamp}) |
| 70 | +# |
0 commit comments