diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-15 10:37:55 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-15 10:37:55 +0200 |
| commit | 6d2ae77ccb31844c6c366911ee1b4bc43bd691f6 (patch) | |
| tree | d9d1b89d09475aa8d19f0f46219400fe7b3ea12a /internal | |
| parent | a7733cd4ab00b542d7e1afd53d9319b7f8b33674 (diff) | |
some more about timestamps
debugging
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/types/types.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/internal/types/types.go b/internal/types/types.go index 6e8cd3b..c4ea2ad 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -3,18 +3,20 @@ package types import "fmt" type OpenEvent struct { - FD int32 - TID uint32 - Time uint64 - Filename [256]byte // TODO, use same value as in ioriot.bpf.h - Comm [16]byte + FD int32 + TID uint32 + EnterTime uint64 + ExitTime uint64 + Filename [256]byte // TODO, use same value as in ioriot.bpf.h + Comm [16]byte } func (e OpenEvent) String() string { filename := e.Filename[:] comm := e.Comm[:] - return fmt.Sprintf("%v tid:%d fd:%d filename:%s, comm:%s", - e.Time, e.TID, e.FD, string(filename), string(comm)) + duration := float64(e.ExitTime-e.EnterTime) / float64(1_000_000) + return fmt.Sprintf("time:(%v=(%v-%v)/1mio) tid:%d fd:%d filename:%s, comm:%s", + duration, e.EnterTime, e.ExitTime, e.TID, e.FD, string(filename), string(comm)) } type FdEvent struct { @@ -26,6 +28,7 @@ type FdEvent struct { } func (e FdEvent) String() string { - duration := (e.ExitTime - e.EnterTime) / 1000000000000.0 - return fmt.Sprintf("%vms opId:%d tid:%v fd:%v", duration, e.OpID, e.TID, e.FD) + duration := float64(e.ExitTime-e.EnterTime) / float64(1_000_000) + return fmt.Sprintf("time:(%vms=(%v-%v)/1mio) opId:%d tid:%v fd:%v", + duration, e.EnterTime, e.ExitTime, e.OpID, e.TID, e.FD) } |
