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

Method BlockProfile

internal/debug/api.go:129–134  ·  view source on GitHub ↗

BlockProfile turns on goroutine profiling for nsec seconds and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.

(file string, nsec uint)

Source from the content-addressed store, hash-verified

127// file. It uses a profile rate of 1 for most accurate information. If a different rate is
128// desired, set the rate and write the profile manually.
129func (*HandlerT) BlockProfile(file string, nsec uint) error {
130 runtime.SetBlockProfileRate(1)
131 time.Sleep(time.Duration(nsec) * time.Second)
132 defer runtime.SetBlockProfileRate(0)
133 return writeProfile("block", file)
134}
135
136// SetBlockProfileRate sets the rate of goroutine block profile data collection.
137// rate 0 disables block profiling.

Callers

nothing calls this directly

Calls 3

writeProfileFunction · 0.85
SetBlockProfileRateMethod · 0.80
SleepMethod · 0.80

Tested by

no test coverage detected