MCPcopy Create free account
hub / github.com/ddev/ddev / CheckGoroutines

Function CheckGoroutines

pkg/util/debug.go:86–100  ·  view source on GitHub ↗

CheckGoroutines updates the number of goroutines and optionally outputs the list of them on verbose. Use with `defer util.CheckGoroutines()`

()

Source from the content-addressed store, hash-verified

84// and optionally outputs the list of them on verbose.
85// Use with `defer util.CheckGoroutines()`
86func CheckGoroutines() {
87 globalconfig.GoroutineCount = runtime.NumGoroutine()
88 if nodeps.IsEnvTrue("DDEV_GOROUTINES") {
89 if globalconfig.DdevVerbose {
90 buf := new(bytes.Buffer)
91
92 // Lookup "goroutine" profile
93 p := pprof.Lookup("goroutine")
94 // Write it to stderr
95 _ = p.WriteTo(buf, 2)
96 Verbose("%s", buf.String())
97 }
98 output.UserOut.Printf("goroutines=%d at exit of main()", globalconfig.GoroutineCount)
99 }
100}

Callers 1

mainFunction · 0.92

Calls 2

IsEnvTrueFunction · 0.92
VerboseFunction · 0.85

Tested by

no test coverage detected