mirror of
https://codeberg.org/scip/io-exporter.git
synced 2025-12-17 04:21:00 +01:00
add waitgroup for goroutine 1
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/directio"
|
||||
@@ -32,7 +33,10 @@ func NewExporter(conf *Config, alloc *Alloc, metrics *Metrics) *Exporter {
|
||||
}
|
||||
|
||||
// starts the primary go-routine, which will run the io checks for ever
|
||||
func (exp *Exporter) RunIOchecks() {
|
||||
func (exp *Exporter) RunIOchecks() sync.WaitGroup {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
var res_r, res_w Result
|
||||
@@ -60,6 +64,8 @@ func (exp *Exporter) RunIOchecks() {
|
||||
time.Sleep(time.Duration(exp.conf.Sleeptime) * time.Second)
|
||||
}
|
||||
}()
|
||||
|
||||
return wg
|
||||
}
|
||||
|
||||
// call an io measurement and collect time needed
|
||||
|
||||
Reference in New Issue
Block a user