add option to start http server for profiling

This commit is contained in:
crapStone 2024-04-28 22:46:55 +02:00 committed by crapStone
parent ca9433e0ea
commit 52bc59aee9
3 changed files with 34 additions and 4 deletions

18
server/profiling.go Normal file
View file

@ -0,0 +1,18 @@
package server
import (
"log"
"net/http"
_ "net/http/pprof"
)
func StartProfilingServer(listeningAddress string) {
server := &http.Server{
Addr: listeningAddress,
Handler: http.DefaultServeMux,
}
go func() {
log.Fatal(server.ListenAndServe())
}()
}