回测时添加-cpu-profile参数,启用性能测试,输出cpu.profile到回测目录下。然后执行下面命令可以查看结果
go tool pprof -http :6060 cpu.profile回测时添加-cpu-profile参数,启用性能测试,然后执行下面命令可以查看结果
go tool pprof --http=:6061 http://localhost:6060/debug/fgprof?seconds=10命令行启动添加-mem-profile参数,将会在6060端口提供pprof分析接口。执行下面命令查看当前内存占用最多:
go tool pprof http://localhost:6060/debug/pprof/heap
> top然后执行list [method]即可显示具体某个方法的内存行热点。
上面go tool pprof命令同时会生成一个heap文件,等待一段时间再次执行得到新heap文件。
然后执行go tool pprof -base old_path new_path可分析两个heap文件差异,使用top和list继续分析即可。
上面的方法只能显示申请内存最多的位置,但复杂项目中泄露对象可能被非常多位置跟踪,任意一处保留引用即导致内存泄露,可使用goref排查未释放的引用。
先启动进程,查询进程ID,然后执行:
grf attach [PID]
go tool pprof -http=:5079 ./grf.outgit tag v1.0.0
git push origin --tags- 被引用模块执行
go mod init添加go.mod文件,修改module后的模块名 - 执行上面
git tag添加新版本 - 在当前项目(和依赖当前项目的入口项目)添加依赖:
go get 模块名@version - 在当前项目(和依赖当前项目的入口项目)的
go.mod中添加replace指令,改为本地绝对或相对路径
您只需将web/ui/svelte.config.js中的adapter-static改为adapter-auto,然后执行npm run dev,浏览器访问http://localhost:5173,即可实时预览ui变动。
后端接口默认访问http://localhost:8000。
It is not recommended to replace encoding/json with sonic. The binary file will increase by 15M (on Windows)
- 将策略注入改为接口,以便允许从结构体继承。