summaryrefslogtreecommitdiff
path: root/cmd/ioriotng
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-02-13 10:26:47 +0200
committerPaul Buetow <paul@buetow.org>2024-02-13 10:26:47 +0200
commita1b917899d564d681f0dce682583d951e0c8a3ae (patch)
treefa7a7594a5a855d4f5019543827f7a4e783e2d56 /cmd/ioriotng
parente43fba8ef47a7a435809ebc09c799254c1c1fcf7 (diff)
collect enter and exit times of the syscall tracepoints
Diffstat (limited to 'cmd/ioriotng')
-rw-r--r--cmd/ioriotng/main.go16
1 files changed, 9 insertions, 7 deletions
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 {