MCPcopy Create free account
hub / github.com/PuerkitoBio/fetchbot / printMemStats

Function printMemStats

example/full/main.go:150–165  ·  view source on GitHub ↗
(di *fetchbot.DebugInfo)

Source from the content-addressed store, hash-verified

148}
149
150func printMemStats(di *fetchbot.DebugInfo) {
151 var mem runtime.MemStats
152 runtime.ReadMemStats(&mem)
153 buf := bytes.NewBuffer(nil)
154 buf.WriteString(strings.Repeat("=", 72) + "\n")
155 buf.WriteString("Memory Profile:\n")
156 buf.WriteString(fmt.Sprintf("\tAlloc: %d Kb\n", mem.Alloc/1024))
157 buf.WriteString(fmt.Sprintf("\tTotalAlloc: %d Kb\n", mem.TotalAlloc/1024))
158 buf.WriteString(fmt.Sprintf("\tNumGC: %d\n", mem.NumGC))
159 buf.WriteString(fmt.Sprintf("\tGoroutines: %d\n", runtime.NumGoroutine()))
160 if di != nil {
161 buf.WriteString(fmt.Sprintf("\tNumHosts: %d\n", di.NumHosts))
162 }
163 buf.WriteString(strings.Repeat("=", 72))
164 fmt.Println(buf.String())
165}
166
167// stopHandler stops the fetcher if the stopurl is reached. Otherwise it dispatches
168// the call to the wrapped Handler.

Callers 2

mainFunction · 0.85
runMemStatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected