profile采样的实现
CPU profiling
// runtime/pprof/pprof.go
// 开启CPU采样,并设置频率
func StartCPUProfile(w io.Writer) error {
cpu.profiling = true
runtime.SetCPUProfileRate(hz)
go profileWriter(w)
}Mem Profiling
Last updated