Skip to content

Commit 38eaded

Browse files
committed
Add support for http/pprof
1 parent 400aa2d commit 38eaded

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

web.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/base64"
88
"fmt"
99
"http"
10+
"http/pprof"
1011
"io/ioutil"
1112
"log"
1213
"mime"
@@ -442,7 +443,13 @@ func (s *Server) Run(addr string) {
442443
s.initServer()
443444

444445
mux := http.NewServeMux()
446+
447+
mux.Handle("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
448+
mux.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
449+
mux.Handle("/debug/pprof/heap", http.HandlerFunc(pprof.Heap))
450+
mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
445451
mux.Handle("/", s)
452+
446453
s.Logger.Printf("web.go serving %s\n", addr)
447454

448455
l, err := net.Listen("tcp", addr)

0 commit comments

Comments
 (0)