aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/main.go b/main.go
index cba6e1b..5e836f1 100644
--- a/main.go
+++ b/main.go
@@ -11,6 +11,7 @@ import (
"syscall"
"go.lindenii.runxiyu.org/lindenii-common/clog"
+ _ "net/http/pprof"
)
func main() {
@@ -93,5 +94,17 @@ func main() {
}
}()
+ // Pprof listener
+ pprof_listener, err := net.Listen("tcp", "localhost:6060")
+ if err != nil {
+ clog.Fatal(1, "Listening pprof: "+err.Error())
+ }
+ clog.Info("Listening pprof on tcp localhost:6060")
+ go func() {
+ if err = http.Serve(pprof_listener, nil); err != nil {
+ clog.Fatal(1, "Serving pprof: "+err.Error())
+ }
+ }()
+
select {}
}