print metrics on hevring too

This commit is contained in:
Norwin 2022-01-02 08:45:11 +01:00
parent 9071a1800a
commit 8e4e38b258
1 changed files with 14 additions and 2 deletions

View File

@ -25,6 +25,18 @@ func ConnectHevring(ránAddress string, stop chan bool, wg *sync.WaitGroup) *Hev
go rpc.ServeConn(conn) go rpc.ServeConn(conn)
fmt.Printf("[hevring] awaiting task from Rán\n") fmt.Printf("[hevring] awaiting task from Rán\n")
// print performance
go func() {
for {
time.Sleep(5 * time.Second)
if pixelflut.PerformanceReporter.Enabled {
fmt.Println(pixelflut.PerformanceReporter)
}
}
}()
// add listener to stop the task, if this hevring should stop
// (either because Rán told us so, or we received an interrupt)
h.quit = stop h.quit = stop
h.wg = wg h.wg = wg
h.wg.Add(1) h.wg.Add(1)
@ -44,8 +56,8 @@ func ConnectHevring(ránAddress string, stop chan bool, wg *sync.WaitGroup) *Hev
type Hevring struct { type Hevring struct {
PreviewPath string PreviewPath string
task pixelflut.FlutTask task pixelflut.FlutTask
taskQuit chan bool taskQuit chan bool // if closed, task is stopped.
quit chan bool quit chan bool // if closed, kills this hevring
wg *sync.WaitGroup wg *sync.WaitGroup
} }