Skip to content

Instantly share code, notes, and snippets.

@markstgodard
Created March 25, 2016 14:29
Show Gist options
  • Save markstgodard/c84bf9219d12ecb87fc5 to your computer and use it in GitHub Desktop.
Save markstgodard/c84bf9219d12ecb87fc5 to your computer and use it in GitHub Desktop.
diff --git a/main.go b/main.go
index 2a7795b..cff7880 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@ package main
import (
"crypto/tls"
"errors"
+ "log"
"github.com/apcera/nats"
cf_debug_server "github.com/cloudfoundry-incubator/cf-debug-server"
@@ -31,6 +32,9 @@ import (
"syscall"
"time"
+ "net/http"
+ _ "net/http/pprof"
+
"github.com/cloudfoundry/gorouter/metrics"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/grouper"
@@ -47,6 +51,10 @@ const (
)
func main() {
+ go func() {
+ log.Println(http.ListenAndServe("localhost:6060", nil))
+ }()
+
flag.StringVar(&configFile, "c", "", "Configuration File")
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
@markstgodard
Copy link
Author

Attaching:

go tool pprof http://localhost:6060/debug/pprof/profile

  • run some load...

(before the waiting 30s)

  • then run dot.. to convert to dot file..
  • then:
    dot -Tpng mydot.dot < mydot.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment