diff options
| author | Russ Cox <rsc@golang.org> | 2011-03-23 11:43:37 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-03-23 11:43:37 -0400 |
| commit | c19b373c8ab8eca47a9fd02b97d8492cc099ef10 (patch) | |
| tree | 3b497adbbf4825f10de5e7b82e84634e7ad6b20d /src/pkg/runtime/debug.go | |
| parent | f9fc1ddf75b33f73787024c0cb47b15b5a40c2cb (diff) | |
| download | go-c19b373c8ab8eca47a9fd02b97d8492cc099ef10.tar.xz | |
runtime: cpu profiling support
R=r
CC=golang-dev
https://golang.org/cl/4306043
Diffstat (limited to 'src/pkg/runtime/debug.go')
| -rw-r--r-- | src/pkg/runtime/debug.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pkg/runtime/debug.go b/src/pkg/runtime/debug.go index b2357db303..6370a57d80 100644 --- a/src/pkg/runtime/debug.go +++ b/src/pkg/runtime/debug.go @@ -92,4 +92,24 @@ func (r *MemProfileRecord) Stack() []uintptr { // where r.AllocBytes > 0 but r.AllocBytes == r.FreeBytes. // These are sites where memory was allocated, but it has all // been released back to the runtime. +// Most clients should use the runtime/pprof package or +// the testing package's -test.memprofile flag instead +// of calling MemProfile directly. func MemProfile(p []MemProfileRecord, inuseZero bool) (n int, ok bool) + +// CPUProfile returns the next chunk of binary CPU profiling stack trace data, +// blocking until data is available. If profiling is turned off and all the profile +// data accumulated while it was on has been returned, CPUProfile returns nil. +// The caller must save the returned data before calling CPUProfile again. +// Most clients should use the runtime/pprof package or +// the testing package's -test.cpuprofile flag instead of calling +// CPUProfile directly. +func CPUProfile() []byte + +// SetCPUProfileRate sets the CPU profiling rate to hz samples per second. +// If hz <= 0, SetCPUProfileRate turns off profiling. +// If the profiler is on, the rate cannot be changed without first turning it off. +// Most clients should use the runtime/pprof package or +// the testing package's -test.cpuprofile flag instead of calling +// SetCPUProfileRate directly. +func SetCPUProfileRate(hz int) |
