From 8e4e38b2582c9df2bd7a8ff77caa22b8728968fd Mon Sep 17 00:00:00 2001 From: Norwin Date: Sun, 2 Jan 2022 08:45:11 +0100 Subject: [PATCH] print metrics on hevring too --- rpc/dottir.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rpc/dottir.go b/rpc/dottir.go index 5e6a670..0b4946c 100644 --- a/rpc/dottir.go +++ b/rpc/dottir.go @@ -25,6 +25,18 @@ func ConnectHevring(ránAddress string, stop chan bool, wg *sync.WaitGroup) *Hev go rpc.ServeConn(conn) 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.wg = wg h.wg.Add(1) @@ -44,8 +56,8 @@ func ConnectHevring(ránAddress string, stop chan bool, wg *sync.WaitGroup) *Hev type Hevring struct { PreviewPath string task pixelflut.FlutTask - taskQuit chan bool - quit chan bool + taskQuit chan bool // if closed, task is stopped. + quit chan bool // if closed, kills this hevring wg *sync.WaitGroup }