github.com/docker/containerd@v0.2.9-0.20170509230648-8ef7df579710/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 installs the "/debug/pprof/{block,heap,goroutine,threadcreate}" handler
     8  	_ "net/http/pprof"
     9  
    10  	"github.com/Sirupsen/logrus"
    11  )
    12  
    13  // Enable registers the "/debug/pprof" handler
    14  func Enable(address string) {
    15  	http.Handle("/", http.RedirectHandler("/debug/pprof", http.StatusMovedPermanently))
    16  
    17  	go http.ListenAndServe(address, nil)
    18  	logrus.Debug("pprof listening in address %s", address)
    19  }