From a1b917899d564d681f0dce682583d951e0c8a3ae Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 13 Feb 2024 10:26:47 +0200 Subject: collect enter and exit times of the syscall tracepoints --- cmd/ioriotng/main.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/ioriotng/main.go b/cmd/ioriotng/main.go index eb4d222..cf9c4a0 100644 --- a/cmd/ioriotng/main.go +++ b/cmd/ioriotng/main.go @@ -25,8 +25,8 @@ type openEvent struct { FD int32 OpID int32 TID uint32 - EnterTime int64 - ExitTime int64 + EnterTime uint64 + ExitTime uint64 Filename [256]byte Comm [16]byte } @@ -34,20 +34,22 @@ type openEvent struct { func (e openEvent) String() string { filename := e.Filename[:] comm := e.Comm[:] - return fmt.Sprintf("opId:%d tid:%v fd:%v filename:%s, comm:%s", - e.OpID, e.TID, e.FD, string(filename), string(comm)) + duration := (e.ExitTime - e.EnterTime) / 1000000000000.0 + return fmt.Sprintf("%vms %v %v opId:%d tid:%v fd:%v filename:%s, comm:%s", + duration, e.ExitTime, e.EnterTime, e.OpID, e.TID, e.FD, string(filename), string(comm)) } type fdEvent struct { FD int32 OpID int32 TID uint32 - EnterTime int64 - ExitTime int64 + EnterTime uint64 + ExitTime uint64 } func (e fdEvent) String() string { - return fmt.Sprintf("opId:%d tid:%v fd:%v", e.OpID, e.TID, e.FD) + duration := (e.ExitTime - e.EnterTime) / 1000000000000.0 + return fmt.Sprintf("%vms %v %v opId:%d tid:%v fd:%v", duration, e.ExitTime, e.EnterTime, e.OpID, e.TID, e.FD) } func resizeMap(module *bpf.Module, name string, size uint32) error { -- cgit v1.2.3