github.com/koko1123/flow-go-1@v0.29.6/utils/unittest/heap.go (about)

     1  package unittest
     2  
     3  import (
     4  	"runtime"
     5  
     6  	"github.com/rs/zerolog"
     7  )
     8  
     9  // PrintHeapInfo prints heap object allocation through given logger.
    10  func PrintHeapInfo(logger zerolog.Logger) {
    11  	var m runtime.MemStats
    12  	runtime.ReadMemStats(&m)
    13  	logger.Info().
    14  		Uint64(".Alloc", m.Alloc).
    15  		Uint64(".AllocObjects", m.HeapObjects).
    16  		Uint64(".TotalAlloc", m.TotalAlloc).
    17  		Uint32(".NumGC", m.NumGC).
    18  		Msg("heap allocation digest")
    19  }