Files
orly/pkg/app/resources.go
2025-07-17 13:18:55 +01:00

27 lines
461 B
Go

package app
import (
"orly.dev/pkg/utils/context"
"orly.dev/pkg/utils/log"
"os"
"runtime"
"time"
)
func MonitorResources(c context.T) {
tick := time.NewTicker(time.Minute * 15)
log.I.Ln("running process", os.Args[0], os.Getpid())
for {
select {
case <-c.Done():
log.D.Ln("shutting down resource monitor")
return
case <-tick.C:
log.D.Ln(
"# goroutines", runtime.NumGoroutine(),
"# cgo calls", runtime.NumCgoCall(),
)
}
}
}