StopCPUProfile stops an ongoing CPU profile.
()
| 99 | |
| 100 | // StopCPUProfile stops an ongoing CPU profile. |
| 101 | func (h *HandlerT) StopCPUProfile() error { |
| 102 | h.mu.Lock() |
| 103 | defer h.mu.Unlock() |
| 104 | pprof.StopCPUProfile() |
| 105 | if h.cpuW == nil { |
| 106 | return errors.New("CPU profiling not in progress") |
| 107 | } |
| 108 | log.Info("Done writing CPU profile", "dump", h.cpuFile) |
| 109 | h.cpuW.Close() |
| 110 | h.cpuW = nil |
| 111 | h.cpuFile = "" |
| 112 | return nil |
| 113 | } |
| 114 | |
| 115 | // GoTrace turns on tracing for nsec seconds and writes |
| 116 | // trace data to file. |