diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-20 14:37:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-20 14:37:41 +0300 |
| commit | 96355c79a38032ab4bd880b3b3ff4192ae709795 (patch) | |
| tree | 7a395706e3db680f6e695c8602501741eed6ad45 /internal/eventloop_bytes_test.go | |
| parent | f063e626a28339735da583142e5af864a60c2111 (diff) | |
task 27: add KindSleep and requested sleep metric
Diffstat (limited to 'internal/eventloop_bytes_test.go')
| -rw-r--r-- | internal/eventloop_bytes_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
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) + } +} |
