From a5050cf2dee62f8daf8c9d44c9475400b5a42008 Mon Sep 17 00:00:00 2001 From: Brannon King Date: Tue, 6 Jul 2021 19:42:57 -0700 Subject: [PATCH] [lbry] profile: support fgprof (flame graph) --- btcd.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/btcd.go b/btcd.go index 3ace182c..b93851ba 100644 --- a/btcd.go +++ b/btcd.go @@ -18,6 +18,8 @@ import ( "github.com/btcsuite/btcd/blockchain/indexers" "github.com/btcsuite/btcd/database" "github.com/btcsuite/btcd/limits" + + "github.com/felixge/fgprof" ) const ( @@ -65,6 +67,7 @@ func btcdMain(serverChan chan<- *server) error { // Enable http profiling server if requested. if cfg.Profile != "" { + http.DefaultServeMux.Handle("/debug/fgprof", fgprof.Handler()) go func() { listenAddr := net.JoinHostPort("", cfg.Profile) btcdLog.Infof("Profile server listening on %s", listenAddr)