-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/pprof: under-samples work on short-lived threads #40435
Comments
/cc @hyangah |
I did not add this to the Go1.15 milestone since you've reported that the issue is reproducible in earlier versions of Go. This can change though. |
I'm curious if we know why this issue happens? I could see this happening with per-thread |
I think it's the call from |
It looks like this is fixed in tip, likely thanks to CL 240003 / commit bd519d0. The pprof output claims "Total samples = 5.11s", which is a close match to the "user 0m5.106s" that the
|
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes this is present in go1.13.14 and go1.14.6, though with slightly different shapes. When I ran with Go 1.13, the profile contained zero samples. When I ran with Go 1.14, the process took about 3 seconds longer to run (7.8s vs 5s) and included 2.2s worth of samples for the function of interest. (Though if this worked as I expect, the profiles would cover the same amount of time as the "time" shell built-in reported.)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
On a linux/amd64 machine, I ran a program that does 5ms of work at a time on each of 1000 worker goroutines, and uses
runtime.LockOSThread
andruntime.Goexit
to force each worker goroutine to be on a different OS thread.What did you expect to see?
I expected the CPU time reported by the shell's
time
built-in and the CPU time reported bygo tool pprof
to roughly match.What did you see instead?
When doing 5ms of work on each of 1000 unique threads, the shell's
time
built-in reports 5103ms of user-space CPU time, andgo tool pprof
reports only 50ms of CPU time.The text was updated successfully, but these errors were encountered: