Print runtime stats every minute when --debug flag is set
This commit is contained in:
22
utils.go
Normal file
22
utils.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
func startRuntimeProfiler() {
|
||||
m := &runtime.MemStats{}
|
||||
|
||||
for {
|
||||
runtime.ReadMemStats(m)
|
||||
|
||||
fmt.Println("-----------------------")
|
||||
fmt.Println("Goroutines:", runtime.NumGoroutine())
|
||||
fmt.Println("Memory acquired:", m.Sys)
|
||||
fmt.Println("Memory used:", m.Alloc)
|
||||
|
||||
time.Sleep(time.Minute)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user