Skip to content

Commit df74c98

Browse files
committed
feat: save vsock perf tests data
Save logs and json files for vsock perf tests. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
1 parent 6d74ea4 commit df74c98

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/integration_tests/performance/test_vsock_ab.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33
"""Tests the VSOCK throughput of Firecracker uVMs."""
44

5+
import json
56
import os
7+
from pathlib import Path
68

79
import pytest
810

@@ -73,7 +75,14 @@ def guest_command(self, port_offset):
7375
@pytest.mark.parametrize("payload_length", ["64K", "1024K"], ids=["p64K", "p1024K"])
7476
@pytest.mark.parametrize("mode", ["g2h", "h2g", "bd"])
7577
def test_vsock_throughput(
76-
microvm_factory, guest_kernel_acpi, rootfs, vcpus, payload_length, mode, metrics
78+
microvm_factory,
79+
guest_kernel_acpi,
80+
rootfs,
81+
vcpus,
82+
payload_length,
83+
mode,
84+
metrics,
85+
results_dir,
7786
):
7887
"""
7988
Test vsock throughput for multiple vm configurations.
@@ -107,4 +116,16 @@ def test_vsock_throughput(
107116
test = VsockIPerf3Test(vm, mode, payload_length)
108117
data = test.run_test(vm.vcpus_count + 2)
109118

119+
cpu_load_path = Path(results_dir / "cpu_load.json")
120+
with open(cpu_load_path, "w", encoding="utf-8") as f:
121+
json.dump(data["cpu_load_raw"], f)
122+
for i, g2h in enumerate(data["g2h"]):
123+
path = Path(results_dir / f"g2h_{i}.json")
124+
with open(path, "w", encoding="utf-8") as f:
125+
json.dump(g2h, f)
126+
for i, h2g in enumerate(data["h2g"]):
127+
path = Path(results_dir / f"h2g_{i}.json")
128+
with open(path, "w", encoding="utf-8") as f:
129+
json.dump(h2g, f)
130+
110131
emit_iperf3_metrics(metrics, data, VsockIPerf3Test.WARMUP_SEC)

0 commit comments

Comments
 (0)