MCPcopy Create free account
hub / github.com/CPChain/chain / StartMemProfile

Method StartMemProfile

internal/profile/handler.go:182–198  ·  view source on GitHub ↗

StartMemProfile starts the memory profiling rate that controls the fraction of memory allocations that are recorded and reported in the memory profile.

(rate int, file string)

Source from the content-addressed store, hash-verified

180// StartMemProfile starts the memory profiling rate that controls the fraction of memory allocations
181// that are recorded and reported in the memory profile.
182func (h *HandlerT) StartMemProfile(rate int, file string) error {
183 h.mu.Lock()
184 defer h.mu.Unlock()
185
186 if h.memW != nil {
187 return errors.New("Memory heap profiling already in progress")
188 }
189 f, err := os.Create(file)
190 if err != nil {
191 return err
192 }
193 h.memFile = file
194 h.memW = f
195
196 runtime.MemProfileRate = rate
197 return nil
198}
199
200// StopMemHeapProfile stops an ongoing memory heap profile
201func (h *HandlerT) StopMemHeapProfile() error {

Callers

nothing calls this directly

Calls 3

LockMethod · 0.80
UnlockMethod · 0.80
CreateMethod · 0.65

Tested by

no test coverage detected