]> Cypherpunks repositories - gostls13.git/commitdiff
net/http/pprof: updated documentation (run an http server)
authorPatrick Crosby <patrick@stathat.com>
Tue, 4 Sep 2012 01:27:20 +0000 (11:27 +1000)
committerAndrew Gerrand <adg@golang.org>
Tue, 4 Sep 2012 01:27:20 +0000 (11:27 +1000)
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

index 06fcde1447fb6148bfa6a4b8c8ab323d89bb668f..7a9f465c4776093f4c88f6a16a860e47775233be 100644 (file)
 // 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