2012-12-27 14:27:26 +00:00
|
|
|
package beego
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http/pprof"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ProfController struct {
|
|
|
|
Controller
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *ProfController) Get() {
|
2013-01-04 06:19:13 +00:00
|
|
|
switch this.Ctx.Params[":pp"] {
|
|
|
|
default:
|
2012-12-27 14:27:26 +00:00
|
|
|
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
|
2013-01-04 06:19:13 +00:00
|
|
|
case "":
|
|
|
|
pprof.Index(this.Ctx.ResponseWriter, this.Ctx.Request)
|
|
|
|
case "cmdline":
|
2012-12-27 14:27:26 +00:00
|
|
|
pprof.Cmdline(this.Ctx.ResponseWriter, this.Ctx.Request)
|
2013-01-04 06:19:13 +00:00
|
|
|
case "profile":
|
2012-12-27 14:27:26 +00:00
|
|
|
pprof.Profile(this.Ctx.ResponseWriter, this.Ctx.Request)
|
2013-01-04 06:19:13 +00:00
|
|
|
case "symbol":
|
2012-12-27 14:27:26 +00:00
|
|
|
pprof.Symbol(this.Ctx.ResponseWriter, this.Ctx.Request)
|
|
|
|
}
|
2012-12-27 14:42:16 +00:00
|
|
|
this.Ctx.ResponseWriter.WriteHeader(200)
|
2012-12-27 14:27:26 +00:00
|
|
|
}
|