From 7da9e79fb3e1b85afb1f5c19e06695a069c1dd6a Mon Sep 17 00:00:00 2001 From: Patrick Crosby Date: Sat, 22 Sep 2012 05:54:59 +1000 Subject: [PATCH] [release-branch.go1] net/http/pprof: updated documentation (run an http server) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ««« backport 4965beed4492 net/http/pprof: updated documentation (run an http server) Added instructions for starting an http server to the godoc header for this package. With the old instructions, the example "go tool pprof..." commands wouldn't work unless you happen to be running an http server on port 6060 in your application. R=golang-dev, minux.ma, adg, giacomo.tartari CC=golang-dev https://golang.org/cl/6483049 »»» --- src/pkg/net/http/pprof/pprof.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pkg/net/http/pprof/pprof.go b/src/pkg/net/http/pprof/pprof.go index 06fcde1447..7a9f465c47 100644 --- a/src/pkg/net/http/pprof/pprof.go +++ b/src/pkg/net/http/pprof/pprof.go @@ -14,6 +14,14 @@ // To use pprof, link this package into your program: // import _ "net/http/pprof" // +// If your application is not already running an http server, you +// need to start one. Add "net/http" and "log" to your imports and +// the following code to your main function: +// +// go func() { +// log.Println(http.ListenAndServe("localhost:6060", nil)) +// }() +// // Then use the pprof tool to look at the heap profile: // // go tool pprof http://localhost:6060/debug/pprof/heap -- 2.50.0