github.com/georgethebeatle/containerd@v0.2.5/api/http/pprof/pprof.go (about) 1 package pprof 2 3 import ( 4 // expvar init routine adds the "/debug/vars" handler 5 _ "expvar" 6 "net/http" 7 "net/http/pprof" 8 9 "github.com/Sirupsen/logrus" 10 ) 11 12 // Enable registers the "/debug/pprof" handler 13 func Enable(address string) { 14 http.Handle("/", http.RedirectHandler("/debug/pprof", http.StatusMovedPermanently)) 15 16 http.Handle("/debug/pprof/block", pprof.Handler("block")) 17 http.Handle("/debug/pprof/heap", pprof.Handler("heap")) 18 http.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine")) 19 http.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate")) 20 21 go http.ListenAndServe(address, nil) 22 logrus.Debug("pprof listening in address %s", address) 23 }