pprof (profile.proto) symbols ambiguity

75 views
Skip to first unread message

Iskander Sharipov

unread,
Jan 24, 2022, 9:55:33 AM1/24/22
to golang-nuts
Imagine that we have these two cases:

1. A function `f` with one anonymous function inside
2. A type `f` with method `func1` (f is a by-value receiver)

This will result in both entries to be identical in the generated profile.

> pkg.f.func1 -- refers to anonymous function (1)
> pkg.f.func1 -- refers to func1 method inside f

This ambiguity can be solved with a types table, but that's too much of the effort in my opinion.

For pointer receivers, we get a nice `pkg.(*f).func1` notation that can be parsed easily. We could use `pkg.(f).func1` to make value receiver methods distinguishable too.

As far as I know, the whole point of this notation is to make symbols unique. This works, since we can't have `f` as a type name and a function name at the same time. Unfortunately, the current notation is not good enough to make these two distinguishable if we haven't parsed/typechecked package yet. This is not always possible and desirable: a profile should be useful even without the being sources available.

Question: am I missing something? Is there an easy way to tell what profile symbol points to?

I'm using https://github.com/google/pprof to parse the profiles.

Thank you in advance! :)
Untitled.png
Reply all
Reply to author
Forward
0 new messages