diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-11 22:28:41 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-11 22:28:41 +0200 |
| commit | fe024ec9fc47b96b5cc9b3301ebf311510568fda (patch) | |
| tree | 3425a50020dceaf218e3192b5a1a881c43ab3ddf | |
| parent | 0f3e937fff5e8e7407f262694e8e2558bcfec703 (diff) | |
initial timestamps
| -rwxr-xr-x | build.sh | 2 | ||||
| -rw-r--r-- | main.bpf.c | 4 | ||||
| -rw-r--r-- | main.go | 20 | ||||
| -rw-r--r-- | maps.bpf.h | 4 |
4 files changed, 20 insertions, 10 deletions
@@ -17,4 +17,4 @@ export CGO_LDFLAGS="-lelf -lzstd $LIBBPFGO/output/libbpf.a" export GOOS=linux export GOARCH=amd64 -go build -race -tags netgo -ldflags '-w -extldflags "-static"' -o ioriotng ./main.go +go build -race -tags netgo -ldflags '-w -extldflags "-static"' -o ioriotng ./cmd/ioriotng/main.go @@ -17,7 +17,9 @@ int handle_enter_open(struct trace_event_raw_sys_enter *ctx) { return 0; u32 tid = bpf_get_current_pid_tgid(); - struct open_event event = { .op_id = OPEN }; + struct open_event event = { + .op_id = OPEN, + }; bpf_probe_read_user_str(event.filename, sizeof(event.filename), (void *)ctx->args[0]); bpf_get_current_comm(&event.comm, sizeof(event.comm)); @@ -22,11 +22,13 @@ type BpfMapper interface { } type openEvent struct { - FD int32 - OpID int32 - TID uint32 - Filename [256]byte - Comm [16]byte + FD int32 + OpID int32 + TID uint32 + EnterTime int64 + ExitTime int64 + Filename [256]byte + Comm [16]byte } func (e openEvent) String() string { @@ -37,9 +39,11 @@ func (e openEvent) String() string { } type fdEvent struct { - FD int32 - OpID int32 - TID uint32 + FD int32 + OpID int32 + TID uint32 + EnterTime int64 + ExitTime int64 } func (e fdEvent) String() string { @@ -4,6 +4,8 @@ struct open_event { int fd; int op_id; u32 tid; + long enter_time; + long exit_time; char filename[256]; char comm[16]; }; @@ -26,6 +28,8 @@ struct fd_event { int fd; int op_id; u32 tid; + long enter_time; + long exit_time; }; struct { |
