Go CPU profile is lacking function call information
<p>I have been trying to dive in to Go (golang) performance analysis, based on articles like <a href="https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs" rel="nofollow">https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs</a> .</p>

<p>However, in the actual profiled programs, the generated CPU profiles have very little information. The go tool either tells that the profile is empty or it has no information about any function calls. This happens on both OS X and Linux.</p>

<p>I generated a minimal example of this situation - I am gathering the profile in a similar manner and facing the same issues in actual programs, too.</p>

<p>Here's the source code for <code>miniprofile/main.go</code>:</p>

<pre><code>package main

import (
    "fmt"
    "os"
    "runtime/pprof"
)

func do_something(prev string, limit int) {
    if len(prev) &lt; limit {
        do_something(prev+"a", limit)
    }
}

func main() {
    f, err := os.Create("./prof")
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
    pprof.StartCPUProfile(f)
    defer pprof.StopCPUProfile()

    do_something("", 100000)
}
</code></pre>

<p>I am expecting to see a CPU profile that tells that almost all the time has been spent on different recursive calls to do_something.</p>

<p>However, this happens (the minimal app above is called miniprofile) - not very useful:</p>

<pre><code>$ go version
go version go1.6.2 darwin/amd64
$ go install .
$ miniprofile
$ go tool pprof --text prof
1.91s of 1.91s total (  100%)
      flat  flat%   sum%        cum   cum%
     1.91s   100%   100%      1.91s   100%
</code></pre>

<p>Am I doing something in a horribly wrong way?</p>