2 Star 4 Fork 10

王布衣/engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config_profile.go 657 Bytes
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2023-12-16 09:46 . 性能分析默认调整为关闭状态
package config
import (
"fmt"
"gitee.com/quant1x/gox/logger"
"net/http"
_ "net/http/pprof"
)
type PprofParameter struct {
Enable bool `yaml:"enable" default:"false"` // 是否开启go tool pprof
Port int `yaml:"port" default:"6060"` // pprof web端口
}
// PprofEnable 获取配置中pprof开关
func PprofEnable() bool {
return GlobalConfig.Runtime.Pprof.Enable
}
// StartPprof 启动性能分析工具
func StartPprof() {
if !PprofEnable() {
return
}
go func() {
addr := fmt.Sprintf("localhost:%d", GlobalConfig.Runtime.Pprof.Port)
err := http.ListenAndServe(addr, nil)
logger.Info("启动pprof性能分析工具", err)
}()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.2.9

搜索帮助

Cb406eda 1850385 E526c682 1850385