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:
parent
c967f2d63f
commit
3e3abb7b6b
2
beego.go
2
beego.go
@ -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()
|
||||
}
|
||||
|
3
pprof.go
3
pprof.go
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user