1 Star 0 Fork 76

魏大伟 / webconsole

forked from Eriloan / webconsole 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
pprof.go 600 Bytes
一键复制 编辑 原始数据 按行查看 历史
Eriloan 提交于 2016-03-04 15:42 . 首个版本
package website
import (
"net/http"
"runtime/pprof"
)
func init() {
Add_HandleFunc("get", "/pprof", Pprof_handler)
}
func Pprof_handler(w http.ResponseWriter, r *http.Request) {
ctx := NewContext(w, r)
user, pwd, ok := r.BasicAuth()
if ok {
if "admin" == user && "password" == pwd {
ctx.SetContentType("text/plain")
// p := pprof.Lookup("goroutine")
p := pprof.Lookup("heap")
p.WriteTo(w, 1)
return
} else {
ctx.BasicAuth("Please enter the password authentication information")
}
} else {
ctx.BasicAuth("Please enter the password authentication information")
}
}
Go
1
https://gitee.com/davidmr/webconsole.git
git@gitee.com:davidmr/webconsole.git
davidmr
webconsole
webconsole
df2cc6327b42

搜索帮助