'go tool pprof' only shows "Type: CPU" and not a callgraph

231 views
Skip to first unread message

Kyle Stanly

unread,
Jun 27, 2016, 4:10:26 PM6/27/16
to golang-nuts
For some strange reason, when I run pprof tool I do not get the Callgraph of the function calls, merely the overall CPU usage, no more. I insert pprof.StartCPUProfile() and pprof.StopCPUProfile() at sections I want to test, and I even adjusted the sampling rate with runtime,SetCPUProfileRate(1000000) to give it the maximum amount of sampling in case it couldn't sample enough.

Unfortunately, there is nothing. Is there a step I am missing here?

Kyle Stanly

unread,
Jun 27, 2016, 4:52:11 PM6/27/16
to golang-nuts
I'd also like to mention I did try both 'runtime/pprof' and github.com/pkg/profile, both yield the same (lack of) results.

Ian Lance Taylor

unread,
Jun 27, 2016, 5:10:39 PM6/27/16
to Kyle Stanly, golang-nuts
On Mon, Jun 27, 2016 at 1:52 PM, Kyle Stanly <thei...@gmail.com> wrote:
> I'd also like to mention I did try both 'runtime/pprof' and
> github.com/pkg/profile, both yield the same (lack of) results.

We can't help you without more information. What kind of system, what
version of Go, what sort of program, exactly what do you type, exactly
what do you see, what do you expect to see instead.

Ian


> On Monday, June 27, 2016 at 4:10:26 PM UTC-4, Kyle Stanly wrote:
>>
>> For some strange reason, when I run pprof tool I do not get the Callgraph
>> of the function calls, merely the overall CPU usage, no more. I insert
>> pprof.StartCPUProfile() and pprof.StopCPUProfile() at sections I want to
>> test, and I even adjusted the sampling rate with
>> runtime,SetCPUProfileRate(1000000) to give it the maximum amount of sampling
>> in case it couldn't sample enough.
>>
>> Unfortunately, there is nothing. Is there a step I am missing here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Dave Cheney

unread,
Jun 27, 2016, 5:54:23 PM6/27/16
to golang-nuts
What are the exact commands you used?

It is easy to misuse proof, here is a slide with some of the gotchas.

http://talks.godoc.org/github.com/davecheney/presentations/writing-high-performance-go.slide#11

Kyle Stanly

unread,
Jun 28, 2016, 9:50:57 AM6/28/16
to golang-nuts, thei...@gmail.com
Apologies, it definitely was a rather quick and "lazy" no-effort post, so it's my fault, and I apologize for not getting back sooner.

The Go version I am using is custom, and also was built with 'all.bat', however, while it built go tools it only had 'asm', 'cgo', 'compile', 'dist', 'go_bootstrap', and 'link'. I do not know if this information is even relevant, but I had to copy the 'pprof' tool from the version of the stable version of Go 1.6, so this may be a potential issue.

I am building on a Cygwin Windows 10 x86_64 system. The type of program I am running is a benchmark I am creating for the runtime changes I made...

Now, I know you guys said to NOT go about this path, but at this time, at the behest of my mentor/advisor, I do not have a choice, and I did In fact make a ton of progress on my own.

Now with that said, I wish to benchmark the memory and CPU usage of my changes versus the default. From what I can recall, in order to see a callgraph of the runtime (which is exactly what I wanted), I needed to pass the '-runtime' flag to pprof, like such...

go tool pprof -runtime [FILE]

However, what I didn't know was I needed to first build it and output it using..

go build -o [OUTPUT_FILE]

And then as well, you already need the .pprof generated (which I received from either runtime/pprof or github/pkg/profile), and do so as such

go tool pprof [OUTPUT_FILE] [PPROF_FILE]

It is resolved now, as I now get a full callgraph. Wish it was easier however.

Kyle Stanly

unread,
Jun 28, 2016, 11:06:29 AM6/28/16
to golang-nuts
Very educational slides, I'll save for later, thanks.
Reply all
Reply to author
Forward
0 new messages