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

Method StartGoTrace

internal/profile/handler.go:105–123  ·  view source on GitHub ↗

tracing StartGoTrace turns on tracing, writing to the given file.

(file string)

Source from the content-addressed store, hash-verified

103// tracing
104// StartGoTrace turns on tracing, writing to the given file.
105func (h *HandlerT) StartGoTrace(file string) error {
106 h.mu.Lock()
107 defer h.mu.Unlock()
108 if h.traceW != nil {
109 return errors.New("trace already in progress")
110 }
111 f, err := os.Create(file)
112 if err != nil {
113 return err
114 }
115 if err := trace.Start(f); err != nil {
116 f.Close()
117 return err
118 }
119 h.traceW = f
120 h.traceFile = file
121 log.Info("Go tracing started", "dump", h.traceFile)
122 return nil
123}
124
125// StopTrace stops an ongoing trace.
126func (h *HandlerT) StopGoTrace() error {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected