Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. func stats() {
  2. var m runtime.MemStats
  3. const MB = 1024 * 1024
  4. runtime.ReadMemStats(&m)
  5.  
  6. fmt.Println("Sys data:")
  7. fmt.Printf("Obtained from system: %dMB\n", m.Sys/MB)
  8. fmt.Println("Pointer Lookups:", m.Lookups)
  9. fmt.Printf("Alloc not freed yet: %dMB\n", m.Alloc/MB)
  10. fmt.Printf("Total Alloc: %dMB\n", m.TotalAlloc/MB)
  11.  
  12. fmt.Println("Garbage Collection data:")
  13. fmt.Println("HeapAlloc:", m.HeapAlloc)
  14. fmt.Println("Last time ran:", time.Unix(0, int64(m.LastGC)))
  15. fmt.Println("Total paused times:", m.PauseTotalNs)
  16. fmt.Println("Number of GC:", m.NumGC)
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement