pprof configuration support, #382

This commit is contained in:
ffdfgdfg
2020-02-09 16:54:40 +08:00
parent 704bba92d1
commit 533dd083fe
9 changed files with 49 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ var (
localType = flag.String("local_type", "p2p", "p2p target")
logPath = flag.String("log_path", "", "npc log path")
debug = flag.Bool("debug", true, "npc debug")
pprofAddr = flag.String("pprof", "", "PProf debug addr (ip:port)")
)
const systemdScript = `[Unit]
@@ -171,6 +172,7 @@ func (p *npc) run() error {
logs.Warning("npc: panic serving %v: %v\n%s", err, string(buf))
}
}()
common.InitPProfFromArg(*pprofAddr)
//p2p or secret command
if *password != "" {
commonConfig := new(config.CommonConfig)

View File

@@ -59,6 +59,7 @@ func main() {
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
log.Fatalln("load config file error", err.Error())
}
common.InitPProfFromFile()
if level = beego.AppConfig.String("log_level"); level == "" {
level = "7"
}