guide: add note about changing mutex rate during execution

When a mutex profile is reported, the counts and delays in the profile
are scaled based on the most recently set rate. So if an application has
changed its profile rate at runtime and collected different samples at
different sampling rates, the samples won't be adjusted correctly when
the pprof is written.
This commit is contained in:
Nick Ripley 2022-01-27 12:31:00 -05:00
parent 9d285548b7
commit b9191dbc30

View file

@ -497,6 +497,7 @@ func semrelease(lock):
The mutex profiler has limitations similar to the block profiler:
- ⚠️ The contention counts and delay times in a mutex profile are adjusted at reporting time based on the *most recent* configurated sampling rate, rather than at sample time. As a result, programs which change the mutex profile fraction in the middle of execution can see skewed counts and delays.
- ⚠️ The maximum number of nested function calls that can be captured in stack traces by the mutex profiler is currently [`32`](https://sourcegraph.com/search?q=context:global+repo:github.com/golang/go+file:src/*+maxStack+%3D&patternType=literal), see [CPU Profiler Limitations](#cpu-profiler-limitations) for more information on what happens when you exceed this limit.
- ⚠️ There is no size limit for the internal hash map that holds the mutex profile. This means it will grow in size until it covers all blocking code paths in your code base. This is not a problem in practice, but might look like a small memory leak if you're observing the memory usage of your process.
- ⚠ [CPU Profiler Labels](#cpu-profiler-labels) or similar are not supported by mutex profiler. It's difficult to add this feature to the current implementation as it could create a memory leak in the internal hash map that holds the memory profiling data.