125
125
// blocking until data is available. If profiling is turned off and all the profile
126
126
// data accumulated while it was on has been returned, CPUProfile returns nil.
127
127
// The caller must save the returned data before calling CPUProfile again.
128
129
// Most clients should use the runtime/pprof package or
129
130
// the testing package's -test.cpuprofile flag instead of calling
130
131
// CPUProfile directly.
133
134
// SetCPUProfileRate sets the CPU profiling rate to hz samples per second.
134
135
// If hz <= 0, SetCPUProfileRate turns off profiling.
135
136
// If the profiler is on, the rate cannot be changed without first turning it off.
136
138
// Most clients should use the runtime/pprof package or
137
139
// the testing package's -test.cpuprofile flag instead of calling
138
140
// SetCPUProfileRate directly.
139
141
func SetCPUProfileRate(hz int)
143
// SetBlockProfileRate controls the fraction of goroutine blocking events
144
// that are reported in the blocking profile. The profiler aims to sample
145
// an average of one blocking event per rate nanoseconds spent blocked.
147
// To include every blocking event in the profile, pass rate = 1.
148
// To turn off profiling entirely, pass rate <= 0.
149
func SetBlockProfileRate(rate int)
151
// BlockProfileRecord describes blocking events originated
152
// at a particular call sequence (stack trace).
153
type BlockProfileRecord struct {
159
// BlockProfile returns n, the number of records in the current blocking profile.
160
// If len(p) >= n, BlockProfile copies the profile into p and returns n, true.
161
// If len(p) < n, BlockProfile does not change p and returns n, false.
163
// Most clients should use the runtime/pprof package or
164
// the testing package's -test.blockprofile flag instead
165
// of calling BlockProfile directly.
166
func BlockProfile(p []BlockProfileRecord) (n int, ok bool)
141
168
// Stack formats a stack trace of the calling goroutine into buf
142
169
// and returns the number of bytes written to buf.
143
170
// If all is true, Stack formats stack traces of all other goroutines