How to use pprof

340 views
Skip to first unread message

Roger Pau Monné

unread,
Nov 6, 2010, 7:39:54 AM11/6/10
to golang-nuts
Hello,

I'm trying to use pprof to profile a program, but I can not get it
working, I follow the instructions at:
http://golang.org/pkg/http/pprof/ and I add the line:

import _ "http/pprof"

To my program, then recompile and run it. When I use gopprof
http://localhost:6060/debug/pprof/heap I get the following error:

Read http://localhost:6060/debug/pprof/symbol
Use of uninitialized value $line in substitution (s///) at
/Users/royger/go/bin/gopprof line 2742.
http://localhost:6060/debug/pprof/symbol doesn't exist

And when using 6prof http://localhost:6060/debug/pprof/heap

prof: can't open http://localhost:6060/debug/pprof/heap: No such file
or directory

Also, I've took a look at netstat and there's nothing listening at
port 6060, so I guess I'm missing something.

Thanks for the help, Roger.

Roger Pau Monné

unread,
Nov 6, 2010, 7:55:24 AM11/6/10
to golang-nuts
Nevermind, just found it. Could someone add to the docs that you need
to import the http package and launch the http server? Something like:

err := http.ListenAndServe(":6060", nil)
if err != nil {
panic("ListenAndServe: " + err.String())
}

2010/11/6 Roger Pau Monné <roy...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages