-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
doc: runtime/pprof: document mutex profiler stack traces #44920
Comments
cc @mknyszek |
@prattmic +100. I think it's fair to say that all of the builtin profilers could use some additional documentation about the kind of data they produce, the sampling that's involved, etc. I'd be happy to help with patches for this, but I'm currently still a bit unsure about the best place to document this. A lot of the profilers have various APIs and knobs exposed in different places, so there isn't always a natural place to put this info. Perhaps the Diagnostics doc would be the right place? I'm thinking each profiler could use a section there, and then all the API docs could be updated to point people in the right direction? |
The inverse of footnote [1] above is that recording in |
@prattmic also great points about the tradeoffs between Unlock vs Lock. I found reporting Unlock very unnatural and confusing, but you make a great point about it being potentially better. |
@felixge Great question about the best to put this kind of documentation since there are several relevant packages. I was initially thinking The main possibilities I see are:
I'd probably lean slightly in favor of golang.org right now. Wherever this ends up, I think we should:
Others like @bcmills and @jayconrod may have more thoughts on the best location for this kind of documentation? |
I think it makes sense to put this somewhere under |
cc @pjweinb |
Change https://go.dev/cl/547057 mentions this issue: |
Amazingly, we seem to have nearly no in-tree documentation on the semantics of block and mutex profiles. Add brief summaries, including the new behavior from CL 506415 and CL 544195. For #14689. For #44920. For #57071. For #61015. Change-Id: I1a6edce7c434fcb43f17c83eb362b1f9d1a32df1 Reviewed-on: https://go-review.googlesource.com/c/go/+/547057 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Rhys Hiltner <rhys@justin.tv> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Amazingly, we seem to have nearly no in-tree documentation on the semantics of block and mutex profiles. Add brief summaries, including the new behavior from CL 506415 and CL 544195. For golang#14689. For golang#44920. For golang#57071. For golang#61015. Change-Id: I1a6edce7c434fcb43f17c83eb362b1f9d1a32df1 Reviewed-on: https://go-review.googlesource.com/c/go/+/547057 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Rhys Hiltner <rhys@justin.tv> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
The mutex profiler records contention on the
Unlock
path of locks, so the stack traces in the profiles all appear asUnlock
calls rather than the more intuitively expectedLock
call [1].This can be a source of confusion. Here's a Stack Overflow question, and I personally fielded a question about this today.
Our own
runtime/pprof
docs say nothing about this (in fact, the complete documentation we have for mutex profiles is "mutex - stack traces of holders of contended mutexes"). This should certainly be expanded.There is a bit of documentation elsewhere online. e.g., @felixge's block profile documentation mentions this property.
Related to #14689.
[1] This also means it isn't possible to directly tell which
Lock
calls are hottest. In practice I doubt this is an issue as typical mutex use has a uniqueUnlock
call for each uniqueLock
call. If this were a problem, we could move the recorded stack trace toLock
here (at the expensive of requiring a slot in thesudog
to store the stack until we can record the event inUnlock
).The text was updated successfully, but these errors were encountered: