question about Profiling Go Programs sample.

217 views
Skip to first unread message

alex-coder

unread,
Sep 27, 2021, 5:03:53 AM9/27/21
to golang-nuts
Hi All,

currently I walk through sample given there:

but when I came at the point where the user should enter web command to the pprof
I do not see that the function DFS call itself on a picture.
Looks like I do use a proper version of the sample - go_pro, where the recursion is present:

So, what could be the reason that the picture is painted not properly ?

I use 1.17.1, windows 10.

Thank you.

Vladimir Varankin

unread,
Sep 27, 2021, 11:38:31 PM9/27/21
to golang-nuts
Hello,

I suspect this is due to how the current version of Go runtime's CPU profiler keeps only up to 64 items, when it builds the function's stack frame (refer to https://github.com/golang/go/blob/go1.17/src/runtime/cpuprof.go#L21) With that, the resulting profile misses the relationship between main.DFS and its parent function, thus it "hangs" beneath the root node now.

Keep in mind that the original post is almost 10 year old now. Some other details might have changed as well.

Cheers,
V.

alex-coder

unread,
Sep 28, 2021, 4:31:55 AM9/28/21
to golang-nuts
Ok, thank you.
Vladimir, is there any resource to read about current and probably future of the go profiling ?
In fact it is not only very important but and very, very interesting.

Thank you.


вторник, 28 сентября 2021 г. в 06:38:31 UTC+3, vlad...@varank.in:

alex-coder

unread,
Sep 29, 2021, 7:59:10 AM9/29/21
to golang-nuts
Vladimir,

I took  runtime/cpuprof.go with  version 1.4, where cpuprof.go just appeared with the same result. :-)
it should be something else.

Regards.

вторник, 28 сентября 2021 г. в 11:31:55 UTC+3, alex-coder:

Vladimir Varankin

unread,
Sep 29, 2021, 2:55:20 PM9/29/21
to golang-nuts
Hey there,

> I took  runtime/cpuprof.go with  version 1.4, where cpuprof.go just appeared with the same result. :-)

I think this is expected.
Go 1.4 was released in 2014 — several years after the original post about pprof, had been published. In fact, Go 1.4 is the version where the relevant part of the runtime's profiler was migrated from C to Go. In this version the same constant, I pointed earlier, already presented in this source code (note maxCPUProfStack=64).

> Vladimir, is there any resource to read about current and probably future of the go profiling?

Depending on what you're looking for, there are quite a few materials I could recommend:
- the documentation for runtime/pprof and net/http/pprof packages [1]
- the documentation for google/pprof tool [2]
- Go wiki on performance [3]
- Felix Geisendörfer's (DataDog) notes on Go profiling internals [4] (he also gave several talks about the topic last summer).

Hope that could help.

alex-coder

unread,
Sep 30, 2021, 2:55:17 AM9/30/21
to golang-nuts
Hi
>>I think this is expected
you are experienced.

>> Depending on what you're looking for,
firstly, I want to learn how to use pprof properly and secondly, 
I even could not imagine that it is not my mistake or not using tool properly..


thank you so much.:-)
среда, 29 сентября 2021 г. в 21:55:20 UTC+3, vlad...@varank.in:

alex-coder

unread,
Sep 30, 2021, 4:38:49 AM9/30/21
to golang-nuts
a little bit more resources:
it seems to be in Chinese (I may be wrong), but thanks to google.
четверг, 30 сентября 2021 г. в 09:55:17 UTC+3, alex-coder:

alex-coder

unread,
Sep 30, 2021, 4:48:14 AM9/30/21
to golang-nuts
Vladimir, one more question.
Does it mean that it is impossible to display recursive call in web by use pprof, it is necessary to use some additional tool, right ?

четверг, 30 сентября 2021 г. в 11:38:49 UTC+3, alex-coder:
Reply all
Reply to author
Forward
0 new messages