debug

package
v0.0.0-...-91a82d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2019 License: LGPL-3.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handler = new(HandlerT)

Handler is the global debugging 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 Setup

func Setup(debugCfg *Config) error

Setup initializes profiling ,It should be called as early as possible in the program.

func StartPProf

func StartPProf(address string)

Types

type Config

type Config struct {
	Pprof            bool   `mapstructure:"debug-pprof"`
	PprofPort        int    `mapstructure:"debug-pprofport"`
	PprofAddr        string `mapstructure:"debug-pprofaddr"`
	Memprofilerate   int    `mapstructure:"debug-memprofilerate"`
	Blockprofilerate int    `mapstructure:"debug-blockprofilerate"`
	Cpuprofile       string `mapstructure:"debug-cpuprofile"`
	Trace            string `mapstructure:"debug-trace"`
}

func DefaultConfig

func DefaultConfig() *Config

type DebugArgs

type DebugArgs struct {
	File string
	Nsec uint64
}

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

func (*HandlerT) BlockProfile(args DebugArgs, reply *bool) error

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

func (h *HandlerT) CpuProfile(args DebugArgs, reply *bool) error

CpuProfile turns on CPU profiling for nsec seconds and writesprofile data to file.

func (*HandlerT) FreeOSMemory

func (*HandlerT) FreeOSMemory(ignore string, reply *bool) error

FreeOSMemory returns unused memory to the OS.

func (*HandlerT) GcStats

func (*HandlerT) GcStats(ignore string, reply *debug.GCStats) error

GcStats returns GC statistics.

func (*HandlerT) GoTrace

func (h *HandlerT) GoTrace(args DebugArgs, reply *bool) error

GoTrace turns on tracing for nsec seconds and writes trace data to file.

func (*HandlerT) MemStats

func (*HandlerT) MemStats(ignore string, reply *runtime.MemStats) error

MemStats returns detailed runtime memory statistics.

func (*HandlerT) MutexProfile

func (*HandlerT) MutexProfile(args DebugArgs, reply *bool) error

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) SetGCPercent

func (*HandlerT) SetGCPercent(v int, reply *int) error

SetGCPercent sets the garbage collection target percentage. It returns the previous setting. A negative value disables GC.

func (*HandlerT) Stacks

func (*HandlerT) Stacks(ignore string, reply *[]byte) error

Stacks returns a printed representation of the stacks of all goroutines.

func (*HandlerT) StartCPUProfile

func (h *HandlerT) StartCPUProfile(file string, reply *bool) error

StartCPUProfile turns on CPU profiling, writing to the given file.

func (*HandlerT) StartGoTrace

func (h *HandlerT) StartGoTrace(file string, reply *bool) error

StartGoTrace turns on tracing, writing to the given file.

func (*HandlerT) StopCPUProfile

func (h *HandlerT) StopCPUProfile(ignore string, reply *bool) error

StopCPUProfile stops an ongoing CPU profile.

func (*HandlerT) StopGoTrace

func (h *HandlerT) StopGoTrace(ignore string, reply *bool) error

StopGoTrace stops an ongoing trace.

func (*HandlerT) WriteMemProfile

func (*HandlerT) WriteMemProfile(file string, reply *bool) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL