One of the things I missed when starting to use golang was departing from profiling tools like visualvm and yourkit for the JVM. Golang has a few options and one of them I’ll be documenting here is profiling your running application and outputting a callgrind file that you can use to understand your running golang app.


Screenshot 2014-10-15 12.45.02


or via SVG!

Screenshot 2014-10-15 13.01.24


To enable  this kind of profiling, follow the instructions for adding pprof to your application:

Once your app is back up and running with pprof and you’re putting some stress on it then it’s time to check out a profile.

Installing kcachegrind on ubuntu:

 sudo apt-get install kcachegrind

launch it:


start debugging an application

jim@localhost: ~
➺ go tool pprof
Gathering CPU profile from for 30 seconds to
Be patient...
Wrote profile to /var/folders/mg/x8pzmrlj6msgkkvvcbpybd580000gn/T/TjhdgALH3Z
Welcome to pprof! For help, type 'help'.
(pprof) callgrind my-cool-grindfile

now just click OPEN on kcachegrind and you should be able to visualize your running application from it’s snapshot.

If you want to view the SVG version then just type in “web” from the pprof interactive shell instead of “callgrind my-cool-grindfile”


If you get the error:
Failed to POST to

edit the following file:
jim@ubuntu:~$ vim /usr/local/go/pkg/tool/linux_amd64/pprof

and change:
if ($@) {
if (1) {