pgweb/utils.go

25 lines
450 B
Go
Raw Normal View History

package main
import (
"fmt"
"runtime"
"time"
)
const MEGABYTE = 1024 * 1024
func startRuntimeProfiler() {
m := &runtime.MemStats{}
for {
runtime.ReadMemStats(m)
fmt.Println("-----------------------")
fmt.Println("Goroutines:", runtime.NumGoroutine())
fmt.Println("Memory acquired:", m.Sys, "bytes,", m.Sys/MEGABYTE, "mb")
fmt.Println("Memory used:", m.Alloc, "bytes,", m.Alloc/MEGABYTE, "mb")
2014-11-22 02:20:30 +03:00
time.Sleep(time.Second * 30)
}
}