MCPcopy Index your code
hub / github.com/bytebase/bytebase / dumpGoroutineProfile

Function dumpGoroutineProfile

backend/runner/monitor/monitor.go:118–131  ·  view source on GitHub ↗
(fileName string)

Source from the content-addressed store, hash-verified

116}
117
118func dumpGoroutineProfile(fileName string) error {
119 f, err := os.Create(fileName)
120 if err != nil {
121 return errors.Errorf("could not create goroutine profile file: %v", err)
122 }
123 defer f.Close()
124
125 goroutineProfile := pprof.Lookup("goroutine")
126 if goroutineProfile == nil {
127 return errors.New("could not look up goroutine profile")
128 }
129
130 return goroutineProfile.WriteTo(f, 0)
131}
132
133func retainMostRecentFilesByPattern(dir, pattern string, retainCount int) error {
134 matches, err := filepath.Glob(filepath.Join(dir, pattern))

Callers 1

checkMemoryMethod · 0.85

Calls 2

ErrorfMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected