Skip to content
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

runtime: cpu profile is not useful due to systemstack #10609

Closed
dvyukov opened this issue Apr 29, 2015 · 4 comments
Closed

runtime: cpu profile is not useful due to systemstack #10609

dvyukov opened this issue Apr 29, 2015 · 4 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Apr 29, 2015

When profiling my program with pprof, I see that 80% of time is spent in runtime.memclr called from runtime._System. This is not useful. I have to attach gdb and sample stacks to figure out that the guilty call stack is:
#0 runtime.memclr () at src/runtime/memclr_amd64.s:13
#1 0x0000000000425b2a in runtime.heapBits.initSpan (h=..., size=131072, n=1, total=131072) at src/runtime/mbitmap.go:284
#2 0x0000000000423d27 in runtime.largeAlloc (size=124063, flag=1, ~r2=0x7f6e0004c7d8) at src/runtime/malloc.go:715
#3 0x000000000045faba in runtime.mallocgc.func3 () at src/runtime/malloc.go:631
#4 0x000000000046aa59 in runtime.systemstack () at src/runtime/asm_amd64.s:262
#5 0x0000000000441a10 in runtime.starttheworld () at src/runtime/proc1.go:643

But it is still unclear who is calling mallocgc.
Similar situation is possible for e.g. defers, for which one won't even get a hint from heap profile.

Cpu profiler should unwind through systemstack.

@dvyukov dvyukov added this to the Go1.5 milestone Apr 29, 2015
@dvyukov
Copy link
Member Author

dvyukov commented Apr 29, 2015

/cc @rsc @randall77 @RLH @aclements

@randall77
Copy link
Contributor

I'm thinking that it would be generally good to combine the stack traces on either side of a systemstack call (not just for profiles). Maybe with a ----- mark as we used to have between stack segments.

@minux
Copy link
Member

minux commented Apr 29, 2015 via email

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/9506 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants