Browse Source

Merge pull request #7953 from gyuho/aaa

etcd-tester: use 'debugutil.PProfHandlers'
Gyu-Ho Lee 8 years ago
parent
commit
e7d705b25f
1 changed files with 5 additions and 10 deletions
  1. 5 10
      tools/functional-tester/etcd-tester/main.go

+ 5 - 10
tools/functional-tester/etcd-tester/main.go

@@ -18,10 +18,11 @@ import (
 	"flag"
 	"fmt"
 	"net/http"
-	"net/http/pprof"
 	"os"
 	"strings"
 
+	"github.com/coreos/etcd/pkg/debugutil"
+
 	"github.com/coreos/pkg/capnslog"
 	"github.com/prometheus/client_golang/prometheus"
 	"golang.org/x/time/rate"
@@ -138,15 +139,9 @@ func main() {
 	http.Handle("/metrics", prometheus.Handler())
 
 	if *enablePprof {
-		http.Handle(pprofPrefix+"/", http.HandlerFunc(pprof.Index))
-		http.Handle(pprofPrefix+"/profile", http.HandlerFunc(pprof.Profile))
-		http.Handle(pprofPrefix+"/symbol", http.HandlerFunc(pprof.Symbol))
-		http.Handle(pprofPrefix+"/cmdline", http.HandlerFunc(pprof.Cmdline))
-		http.Handle(pprofPrefix+"/trace", http.HandlerFunc(pprof.Trace))
-		http.Handle(pprofPrefix+"/heap", pprof.Handler("heap"))
-		http.Handle(pprofPrefix+"/goroutine", pprof.Handler("goroutine"))
-		http.Handle(pprofPrefix+"/threadcreate", pprof.Handler("threadcreate"))
-		http.Handle(pprofPrefix+"/block", pprof.Handler("block"))
+		for p, h := range debugutil.PProfHandlers() {
+			http.Handle(p, h)
+		}
 	}
 
 	go func() { plog.Fatal(http.ListenAndServe(":9028", nil)) }()