StartGoTrace turns on tracing, writing to the given file.
(file string)
| 28 | |
| 29 | // StartGoTrace turns on tracing, writing to the given file. |
| 30 | func (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. |
| 51 | func (h *HandlerT) StopGoTrace() error { |