pprof.go 412 Bytes
Newer Older
“李磊”'s avatar
“李磊” committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package port

import (
	"net/http"
	_ "net/http/pprof"
	"strconv"

	"linkfog.com/public/lib/l"
)

func Start(port int) {
	if port != 0 {
		go func() {
			port := strconv.Itoa(port)
			err := http.ListenAndServe("0.0.0.0:"+port, nil)
			if err != nil {
				l.Error("pprof start", err)
				return
			}
			l.Info("pprof start success")
		}()
	} else {
		l.Debug("pprof switch is off")
	}
}