Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func stats() {
- var m runtime.MemStats
- const MB = 1024 * 1024
- runtime.ReadMemStats(&m)
- fmt.Println("Sys data:")
- fmt.Printf("Obtained from system: %dMB\n", m.Sys/MB)
- fmt.Println("Pointer Lookups:", m.Lookups)
- fmt.Printf("Alloc not freed yet: %dMB\n", m.Alloc/MB)
- fmt.Printf("Total Alloc: %dMB\n", m.TotalAlloc/MB)
- fmt.Println("Garbage Collection data:")
- fmt.Println("HeapAlloc:", m.HeapAlloc)
- fmt.Println("Last time ran:", time.Unix(0, int64(m.LastGC)))
- fmt.Println("Total paused times:", m.PauseTotalNs)
- fmt.Println("Number of GC:", m.NumGC)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement