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

Method StartBlockingProfile

internal/profile/handler.go:142–158  ·  view source on GitHub ↗

StartBlockingProfile starts blocking profiling. rate 0 disables block profiling.

(rate int, file string)

Source from the content-addressed store, hash-verified

140// StartBlockingProfile starts blocking profiling.
141// rate 0 disables block profiling.
142func (h *HandlerT) StartBlockingProfile(rate int, file string) error {
143 h.mu.Lock()
144 defer h.mu.Unlock()
145
146 if h.blockingW != nil {
147 return errors.New("Blocking profiling already in progress")
148 }
149 f, err := os.Create(file)
150 if err != nil {
151 return err
152 }
153 h.blockingFile = file
154 h.blockingW = f
155
156 runtime.SetBlockProfileRate(rate)
157 return nil
158}
159
160// StopBlockProfile stops an ongoing blocking profile
161func (h *HandlerT) StopBlockingProfile() error {

Callers

nothing calls this directly

Calls 4

LockMethod · 0.80
UnlockMethod · 0.80
SetBlockProfileRateMethod · 0.80
CreateMethod · 0.65

Tested by

no test coverage detected