summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-03-14 20:52:38 +0200
committerPaul Buetow <paul@buetow.org>2025-03-14 20:52:38 +0200
commit4e5ec5ec19baab4cfdda66622d86117d32b3b020 (patch)
treeb365380e19c35a29e7215400fa18bdaea5d4a9db
parent8368f9986f9fac55a1f3869a4a99a7c077684c1c (diff)
ok now for real fixed
-rw-r--r--internal/ior.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/internal/ior.go b/internal/ior.go
index 5e78645..51ce2d1 100644
--- a/internal/ior.go
+++ b/internal/ior.go
@@ -82,17 +82,20 @@ func Run(flags flags.Flags) {
}
loop := newEventLoop(flags)
-
- startTime := time.Now()
duration := time.Duration(flags.Duration) * time.Second
fmt.Println("Probing for", duration)
ctx, cancel := context.WithTimeout(context.Background(), duration)
+
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
- defer cancel()
<-c
+ cancel()
+ }()
+
+ go func() {
+ <-ctx.Done()
fmt.Println(loop.stats())
if flags.PprofEnable {
fmt.Println("Stoppig profiling, writing ior.cpuprofile and ior.memprofile")
@@ -102,7 +105,9 @@ func Run(flags flags.Flags) {
}
}()
+ startTime := time.Now()
loop.run(ctx, ch)
+ totalDuration := time.Since(startTime)
<-pprofDone
- fmt.Println("Good bye... (unloading BPF tracepoints will take a few seconds...) after", time.Since(startTime))
+ fmt.Println("Good bye... (unloading BPF tracepoints will take a few seconds...) after", totalDuration)
}