refactor: move profiling code to pprof_*.go

This commit is contained in:
yusing
2025-03-28 07:17:11 +08:00
parent 2f24a1db41
commit 9cb7cc84ee
2 changed files with 0 additions and 0 deletions

20
cmd/pprof_prof.go Normal file
View File

@@ -0,0 +1,20 @@
//go:build pprof
package main
import (
"log"
"net/http"
_ "net/http/pprof"
"runtime"
"runtime/debug"
)
func initProfiling() {
runtime.GOMAXPROCS(2)
debug.SetMemoryLimit(100 * 1024 * 1024)
debug.SetMaxStack(15 * 1024 * 1024)
go func() {
log.Println(http.ListenAndServe(":7777", nil))
}()
}