Start a simpler replacement for davecheney's profile package

This commit is contained in:
Matt Joiner 2014-07-10 00:14:19 +10:00
parent ba83f65ddf
commit 1e4862ace8
1 changed files with 19 additions and 0 deletions

19
util/profile/profile.go Normal file
View File

@ -0,0 +1,19 @@
package profile
import (
"log"
"net/http"
_ "net/http/pprof"
"os"
)
func init() {
if httpAddr := os.Getenv("GOPROF"); httpAddr != "" {
go func() {
err := http.ListenAndServe(httpAddr, nil)
if err != nil {
log.Print(err)
}
}()
}
}