Skip to content

Commit c17aef2

Browse files
committed
feat(tests): add systemd_analyze data as boot time metric
Currently we measure boottime by looking at the Firecracker logs and waiting for the guest to trigger a special boot device inside Firecracker. There is an alternative way of measuring boot time from a guest perspective by using systemd-analyze. Will help us to understand boot times better. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 321b26a commit c17aef2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/integration_tests/performance/test_boottime.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ def find_events(log_data):
6969
return timestamps
7070

7171

72+
def get_systemd_analyze_times(microvm):
73+
rc, stdout, stderr = microvm.ssh.run("systemd-analyze")
74+
assert rc == 0, stderr
75+
assert stderr == ""
76+
77+
boot_line = stdout.splitlines()[0]
78+
pattern = "Startup finished in (.*)ms \(kernel\) \+ (.*)ms \(userspace\) = (.*)ms"
79+
kernel, userspace, total = re.findall(pattern, boot_line)[0]
80+
return int(kernel), int(userspace), int(total)
81+
82+
7283
@pytest.mark.parametrize(
7384
"vcpu_count,mem_size_mib",
7485
[(1, 128), (1, 1024), (2, 2048), (4, 4096)],
@@ -112,4 +123,10 @@ def test_boottime(
112123
boottime_us - build_time.microseconds,
113124
unit="Microseconds",
114125
)
126+
127+
kernel, userspace, total = get_systemd_analyze_times(vm)
128+
metrics.put_metric("systemd_kernel", kernel, unit="Milliseconds")
129+
metrics.put_metric("systemd_userspace",userspace, unit="Milliseconds")
130+
metrics.put_metric("systemd_total", total, unit="Milliseconds")
131+
115132
vm.kill()

0 commit comments

Comments
 (0)