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

Method StartGoTrace

internal/debug/trace.go:30–48  ·  view source on GitHub ↗

StartGoTrace turns on tracing, writing to the given file.

(file string)

Source from the content-addressed store, hash-verified

28
29// StartGoTrace turns on tracing, writing to the given file.
30func (h *HandlerT) StartGoTrace(file string) error {
31 h.mu.Lock()
32 defer h.mu.Unlock()
33 if h.traceW != nil {
34 return errors.New("trace already in progress")
35 }
36 f, err := os.Create(expandHome(file))
37 if err != nil {
38 return err
39 }
40 if err := trace.Start(f); err != nil {
41 f.Close()
42 return err
43 }
44 h.traceW = f
45 h.traceFile = file
46 log.Info("Go tracing started", "dump", h.traceFile)
47 return nil
48}
49
50// StopTrace stops an ongoing trace.
51func (h *HandlerT) StopGoTrace() error {

Callers 2

GoTraceMethod · 0.95
SetupFunction · 0.45

Calls 7

expandHomeFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80
CreateMethod · 0.65
StartMethod · 0.65
CloseMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected