-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: add profiling of stack segment allocation #2197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
Issue #5544 has been merged into this issue. |
FTR, here is the description of the dup: Problem description on golang-nuts: https://groups.google.com/d/msg/golang-nuts/mWXsJJMdL0M/wioVT04ye7UJ In short, pprof misses 7.5% of samples in newstack/oldstack (perf reports them properly). This happens because the profiler ignores samples on g0 (where newstack/oldstack are executed). We need to figure out a way to attribute the samples to the running goroutine. |
It seems to be quite tricky to implement w/o an additional slowdown for stack switch. What do you think about the following workaround? There are some other cases when we discard SIGPROF, e.g. on external threads. So a user may see a profile for Go program, while 95% of time is actually spent on external threads. The user will try to optimize Go code, but it makes no sense. The idea is to create fake functions like: static void ExternalThread(void) {} static void RuntimeScheduler(void) {} static void StackSwitch(void) {} Then, in SIGPROF handler if we encounter a case that we can not handle, create a fake stack with 1 entry pointing to one of the above functions. Then users at least will get some idea of where the time is spent, and the profile will be more consistent with e.g. perf. |
>Suppose we just count the SIGPROF signals that we skipped and report that as part of the profile? External threads and scheduler are quite different. Is there a support for such reporting? It must be supported by pprof --text and --web/svg. What I am proposing is roughly the same, but a bit more detailed and probably simple (because all required support must be there). |
We profile g0 work now, and also there are no stack segments anymore. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: