mirror of
https://github.com/astaxie/beego.git
synced 2024-09-28 21:11:49 +00:00
23 lines
509 B
Go
23 lines
509 B
Go
|
package beego
|
||
|
|
||
|
import (
|
||
|
"net/http/pprof"
|
||
|
)
|
||
|
|
||
|
type ProfController struct {
|
||
|
Controller
|
||
|
}
|
||
|
|
||
|
func (this *ProfController) Get() {
|
||
|
ptype := this.Ctx.Params[":pp"]
|
||
|
if ptype == "" {
|
||
|
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||
|
} else if ptype == "cmdline" {
|
||
|
pprof.Cmdline(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||
|
} else if ptype == "profile" {
|
||
|
pprof.Profile(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||
|
} else if ptype == "symbol" {
|
||
|
pprof.Symbol(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||
|
}
|
||
|
}
|