diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-07 21:26:52 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-07 21:26:52 +0200 |
| commit | 4460a68aa299ad6b63ffbbbb23585b93fad9feee (patch) | |
| tree | 72b585097db224d319e792b51bdf313401fe891d /internal/eventloop.go | |
| parent | 2b91942467052dfb389d9209fc96e6bb52fa2e3f (diff) | |
add pprof option and rename ioriotng to ior
Diffstat (limited to 'internal/eventloop.go')
| -rw-r--r-- | internal/eventloop.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/internal/eventloop.go b/internal/eventloop.go index 90594b5..4961f80 100644 --- a/internal/eventloop.go +++ b/internal/eventloop.go @@ -6,11 +6,12 @@ import ( "fmt" "os" - "ioriotng/internal/flags" - . "ioriotng/internal/generated/types" + "ior/internal/flags" + . "ior/internal/generated/types" ) type eventLoop struct { + flags flags.Flags filter *eventFilter enterEvs map[uint32]*eventPair // Temp. store of sys_enter tracepoints per Tid. files map[int32]file // Track all open files by file descriptor. @@ -20,6 +21,7 @@ type eventLoop struct { func newEventLoop(flags flags.Flags) *eventLoop { return &eventLoop{ + flags: flags, filter: newEventFilter(flags), enterEvs: make(map[uint32]*eventPair), files: make(map[int32]file), @@ -29,9 +31,14 @@ func newEventLoop(flags flags.Flags) *eventLoop { } func (e *eventLoop) run(rawCh <-chan []byte) { - fmt.Println(eventStreamHeader) + if e.flags.PprofEnable { + fmt.Println("Profiling, press Ctrl+C to stop") + fmt.Println(eventStreamHeader) + } for ev := range e.events(rawCh) { - fmt.Println(ev.String()) + if !e.flags.PprofEnable { + fmt.Println(ev.String()) + } if ev.prevPair != nil { // Only recycle the previous event, as the current event is the previous event of the next event! ev.prevPair.recycle() @@ -121,7 +128,6 @@ func (e *eventLoop) syscallExit(exitEv event, ch chan<- *eventPair) { } ev.file = file - // TODO: Filter out all other events not matching comm filter as well when comm filter enabled e.comms[openEv.Tid] = string(openEv.Comm[:]) case *NameEvent: |
