Documentation ¶
Overview ¶
Package debug interfaces Go runtime debugging facilities. This package is mostly glue code making these facilities available through the CLI and RPC subsystem. If you want to use them from Go code, use package runtime instead.
Index ¶
- Variables
- func Exit()
- func LoudPanic(x interface{})
- func Setup(debugCfg *Config) error
- func StartPProf(address string)
- type Config
- type HandlerT
- func (*HandlerT) BlockProfile(file string, nsec uint64) error
- func (h *HandlerT) CpuProfile(file string, nsec uint64) error
- func (*HandlerT) FreeOSMemory()
- func (*HandlerT) GcStats() *debug.GCStats
- func (h *HandlerT) GoTrace(file string, nsec uint64) error
- func (*HandlerT) MemStats() *runtime.MemStats
- func (*HandlerT) MutexProfile(file string, nsec uint64) error
- func (*HandlerT) SetBlockProfileRate(rate int)
- func (*HandlerT) SetGCPercent(v int) int
- func (*HandlerT) SetMutexProfileFraction(rate int)
- func (*HandlerT) Stacks() []byte
- func (h *HandlerT) StartCPUProfile(file string) error
- func (h *HandlerT) StartGoTrace(file string) error
- func (h *HandlerT) StopCPUProfile() error
- func (h *HandlerT) StopGoTrace() error
- func (*HandlerT) WriteBlockProfile(file string) error
- func (*HandlerT) WriteMemProfile(file string) error
- func (*HandlerT) WriteMutexProfile(file string) error
Constants ¶
This section is empty.
Variables ¶
var Handler = new(HandlerT)
Handler is the global debugging handler.
var Memsize memsizeui.Handler
Functions ¶
func Exit ¶
func Exit()
Exit stops all running profiles, flushing their output to the respective file.
func LoudPanic ¶
func LoudPanic(x interface{})
LoudPanic panics in a way that gets all goroutine stacks printed on stderr.
func StartPProf ¶
func StartPProf(address string)
Types ¶
type Config ¶
type Config struct { Pprof bool `mapstructure:"pprof"` PprofPort int `mapstructure:"pprofport"` PprofAddr string `mapstructure:"pprofaddr"` Memprofilerate int `mapstructure:"memprofilerate"` Blockprofilerate int `mapstructure:"blockprofilerate"` Cpuprofile string `mapstructure:"cpuprofile"` Trace string `mapstructure:"trace"` }
func DefaultConfig ¶
func DefaultConfig() *Config
type HandlerT ¶
type HandlerT struct {
// contains filtered or unexported fields
}
HandlerT implements the debugging API. Do not create values of this type, use the one in the Handler variable instead.
func (*HandlerT) BlockProfile ¶
BlockProfile turns on goroutine profiling for nsec seconds and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.
func (*HandlerT) CpuProfile ¶
CpuProfile turns on CPU profiling for nsec seconds and writesprofile data to file.
func (*HandlerT) FreeOSMemory ¶
func (*HandlerT) FreeOSMemory()
FreeOSMemory returns unused memory to the OS.
func (*HandlerT) MutexProfile ¶
MutexProfile turns on mutex profiling for nsec seconds and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.
func (*HandlerT) SetBlockProfileRate ¶
SetBlockProfileRate sets the rate of goroutine block profile data collection. rate 0 disables block profiling.
func (*HandlerT) SetGCPercent ¶
SetGCPercent sets the garbage collection target percentage. It returns the previous setting. A negative value disables GC.
func (*HandlerT) SetMutexProfileFraction ¶
SetMutexProfileFraction sets the rate of mutex profiling.
func (*HandlerT) StartCPUProfile ¶
StartCPUProfile turns on CPU profiling, writing to the given file.
func (*HandlerT) StartGoTrace ¶
StartGoTrace turns on tracing, writing to the given file.
func (*HandlerT) StopCPUProfile ¶
StopCPUProfile stops an ongoing CPU profile.
func (*HandlerT) StopGoTrace ¶
StopGoTrace stops an ongoing trace.
func (*HandlerT) WriteBlockProfile ¶
WriteBlockProfile writes a goroutine blocking profile to the given file.
func (*HandlerT) WriteMemProfile ¶
WriteMemProfile writes an allocation profile to the given file. Note that the profiling rate cannot be set through the API, it must be set on the command line.
func (*HandlerT) WriteMutexProfile ¶
WriteMutexProfile writes a goroutine blocking profile to the given file.