|
|
|
@ -8,6 +8,8 @@ import (
|
|
|
|
|
"io"
|
|
|
|
|
"log"
|
|
|
|
|
"os"
|
|
|
|
|
"runtime"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
mcli "github.com/mitchellh/cli"
|
|
|
|
|
|
|
|
|
@ -17,7 +19,21 @@ import (
|
|
|
|
|
_ "github.com/hashicorp/consul/service_os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func printMemStats() {
|
|
|
|
|
var memStats runtime.MemStats
|
|
|
|
|
runtime.ReadMemStats(&memStats)
|
|
|
|
|
fmt.Printf("Alloc = %v MiB", memStats.Alloc/1024/1024)
|
|
|
|
|
fmt.Printf("\tTotalAlloc = %v MiB", memStats.TotalAlloc/1024/1024)
|
|
|
|
|
fmt.Printf("\tSys = %v MiB", memStats.Sys/1024/1024)
|
|
|
|
|
fmt.Printf("\tNumGC = %v\n", memStats.NumGC)
|
|
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
printMemStats()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
go func() {
|
|
|
|
|
printMemStats()
|
|
|
|
|
}()
|
|
|
|
|
os.Exit(realMain())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|