pgweb/utils.go
2014-11-21 17:20:30 -06:00

25 lines
450 B
Go

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")
time.Sleep(time.Second * 30)
}
}