1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 10:20:56 +00:00

add support goroutine pprof

This commit is contained in:
xiemengjun 2012-12-27 22:42:16 +08:00
parent c967f2d63f
commit 3e3abb7b6b
2 changed files with 4 additions and 1 deletions

View File

@ -156,7 +156,7 @@ func FilterPrefixPath(path string, filter http.HandlerFunc) *App {
func Run() {
if PprofOn {
BeeApp.RegisterController(`/debug/pprof`, &ProfController{})
BeeApp.RegisterController(`/debug/pprof/:pp([\w+])`, &ProfController{})
BeeApp.RegisterController(`/debug/pprof/:pp([\w]+)`, &ProfController{})
}
BeeApp.Run()
}

View File

@ -18,5 +18,8 @@ func (this *ProfController) Get() {
pprof.Profile(this.Ctx.ResponseWriter, this.Ctx.Request)
} else if ptype == "symbol" {
pprof.Symbol(this.Ctx.ResponseWriter, this.Ctx.Request)
} else {
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
}
this.Ctx.ResponseWriter.WriteHeader(200)
}