Description
Using the mutex and block profiles from net/http/pprof
currently requires modifying the application to call runtime.SetBlockProfileRate
and runtime.SetMutexProfileFraction
. Since it's not clear what the performance impact of enabling these profiles is, few people will actually do it.
I'd like to add the following parameters, to make using these two profiles easier to use:
/debug/pprof/block?seconds=1&rate=1
/debug/pprof/mutex?seconds=1&frac=1
If the seconds
parameter isn't specified the endpoints will behave as they currently do. If it is specified the block profile rate or mutex profile fraction will be set (default 1
) and then the handler sleeps for the specified duration. At the end of the duration the profile is written and the original profile rate / fraction is restored.
This proposal requires changing SetBlockProfileRate
to return the previous rate, similar to SetMutexProfileFraction.