github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/cmd/ami-publisher/debug.go (about)

     1  package main
     2  
     3  import (
     4  	"runtime"
     5  
     6  	"github.com/Cloud-Foundations/Dominator/lib/format"
     7  	"github.com/Cloud-Foundations/Dominator/lib/log"
     8  )
     9  
    10  func logMemoryUsage(logger log.DebugLogger) {
    11  	var memStats runtime.MemStats
    12  	runtime.ReadMemStats(&memStats)
    13  	logger.Debugf(0, "Memory: allocated: %s system: %s\n",
    14  		format.FormatBytes(memStats.Alloc),
    15  		format.FormatBytes(memStats.Sys))
    16  }