Open florianl opened 1 year ago
I would also like to see this. 100 samples/second are not enough for some applications.
In my organization we are running multiple-micro services in a golang-based scaffold,I can clearly see such a feature be very important in debugging and in analyzing the efficiency of such services in specific architecture.. Looking forward to see how this proposal will develop in the forth-coming stages..
This proposal is based on https://github.com/golang/go/issues/42502 and adds the ability to configure the sampling rate for CPU profiles.
At the moment it is possible to dynamically collect CPU profiles using the
net/http/pprof
package viago tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
. In this example a 30 second CPU profile is collected. Internally this call utilizespprof.StartCPUProfile()
which uses a hard coded sampling frequency of 100hz.With https://github.com/golang/go/issues/42502 being accepted it would be great if dynamically collected CPU profiles would also get the option to set the sampling frequency. This could be possible by adding an additional parameter besides
seconds
likehertz
.hertz
is just used as an example and input on better naming is always welcomed. This new parameter should be optional and if not set the CPU profile should use the default sampling rate of 100hz.In the following example a CPU profile of 30 seconds with a sampling rate of 257hz is collected:
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30&hertz=257