Skip to content

Commit

Permalink
Fixes #42502
Browse files Browse the repository at this point in the history
runtime/pprof: method StartCPUProfile adds a parameter to allow custom cpu rate.
  • Loading branch information
imxyb committed Nov 12, 2020
1 parent d7974c3 commit b36e81f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/pprof/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,11 @@ func StartCPUProfile(w io.Writer) error {
// convert sample counts to seconds. Instead of requiring
// each client to specify the frequency, we hard code it.
const hz = 100
return StartCPUProfileWithRate(w, hz)
}

// StartCPUProfileWithRate enables CPU profiling for the current process with specified rate.
func StartCPUProfileWithRate(w io.Writer, hz int) error {
cpu.Lock()
defer cpu.Unlock()
if cpu.done == nil {
Expand Down

0 comments on commit b36e81f

Please sign in to comment.