From 96355c79a38032ab4bd880b3b3ff4192ae709795 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 20 May 2026 14:37:41 +0300 Subject: task 27: add KindSleep and requested sleep metric --- internal/eventloop_bytes_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'internal/eventloop_bytes_test.go') diff --git a/internal/eventloop_bytes_test.go b/internal/eventloop_bytes_test.go index 636f80f..54c25d0 100644 --- a/internal/eventloop_bytes_test.go +++ b/internal/eventloop_bytes_test.go @@ -147,3 +147,25 @@ func TestApplyAddressSpaceBytes(t *testing.T) { t.Fatalf("pair.Bytes = %d, want 0 (IO bytes must stay separate)", pair.Bytes) } } + +func TestApplyRequestedSleepNs(t *testing.T) { + pair := &event.Pair{ + EnterEv: &types.SleepEvent{ + TraceId: types.SYS_ENTER_NANOSLEEP, + RequestedNs: 7_500_000, + EventType: types.ENTER_SLEEP_EVENT, + Time: 10, + Pid: 1, + Tid: 2, + }, + ExitEv: &types.RetEvent{ + TraceId: types.SYS_EXIT_NANOSLEEP, + Ret: 0, + }, + } + + applyRequestedSleepNs(pair) + if pair.RequestedSleepNs != 7_500_000 { + t.Fatalf("pair.RequestedSleepNs = %d, want 7500000", pair.RequestedSleepNs) + } +} -- cgit v1.2.3