go-ethereum: github.com/ethereum/go-ethereum/internal/debug Index | Files

package debug

import "github.com/ethereum/go-ethereum/internal/debug"

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

Package Files

api.go flags.go loudpanic.go trace.go

Variables

var DeprecatedFlags = []cli.Flag{
    legacyPprofPortFlag, legacyPprofAddrFlag, legacyMemprofilerateFlag,
    legacyBlockprofilerateFlag, legacyCpuprofileFlag,
}
var Flags = []cli.Flag{
    verbosityFlag, vmoduleFlag, backtraceAtFlag, debugFlag,
    pprofFlag, pprofAddrFlag, pprofPortFlag, memprofilerateFlag,
    blockprofilerateFlag, cpuprofileFlag, traceFlag,
}

Flags holds all command-line flags required for debugging.

var Handler = new(HandlerT)

Handler is the global debugging handler.

var Memsize memsizeui.Handler

func Exit Uses

func Exit()

Exit stops all running profiles, flushing their output to the respective file.

func LoudPanic Uses

func LoudPanic(x interface{})

LoudPanic panics in a way that gets all goroutine stacks printed on stderr.

func Setup Uses

func Setup(ctx *cli.Context) error

Setup initializes profiling and logging based on the CLI flags. It should be called as early as possible in the program.

func StartPProf Uses

func StartPProf(address string, withMetrics bool)

type HandlerT Uses

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) BacktraceAt Uses

func (*HandlerT) BacktraceAt(location string) error

BacktraceAt sets the log backtrace location. See package log for details on the pattern syntax.

func (*HandlerT) BlockProfile Uses

func (*HandlerT) BlockProfile(file string, nsec uint) 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 Uses

func (h *HandlerT) CpuProfile(file string, nsec uint) error

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

func (*HandlerT) FreeOSMemory Uses

func (*HandlerT) FreeOSMemory()

FreeOSMemory forces a garbage collection.

func (*HandlerT) GcStats Uses

func (*HandlerT) GcStats() *debug.GCStats

GcStats returns GC statistics.

func (*HandlerT) GoTrace Uses

func (h *HandlerT) GoTrace(file string, nsec uint) error

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

func (*HandlerT) MemStats Uses

func (*HandlerT) MemStats() *runtime.MemStats

MemStats returns detailed runtime memory statistics.

func (*HandlerT) MutexProfile Uses

func (*HandlerT) MutexProfile(file string, nsec uint) 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) SetBlockProfileRate Uses

func (*HandlerT) SetBlockProfileRate(rate int)

SetBlockProfileRate sets the rate of goroutine block profile data collection. rate 0 disables block profiling.

func (*HandlerT) SetGCPercent Uses

func (*HandlerT) SetGCPercent(v int) int

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

func (*HandlerT) SetMutexProfileFraction Uses

func (*HandlerT) SetMutexProfileFraction(rate int)

SetMutexProfileFraction sets the rate of mutex profiling.

func (*HandlerT) Stacks Uses

func (*HandlerT) Stacks() string

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

func (*HandlerT) StartCPUProfile Uses

func (h *HandlerT) StartCPUProfile(file string) error

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

func (*HandlerT) StartGoTrace Uses

func (h *HandlerT) StartGoTrace(file string) error

StartGoTrace turns on tracing, writing to the given file.

func (*HandlerT) StopCPUProfile Uses

func (h *HandlerT) StopCPUProfile() error

StopCPUProfile stops an ongoing CPU profile.

func (*HandlerT) StopGoTrace Uses

func (h *HandlerT) StopGoTrace() error

StopTrace stops an ongoing trace.

func (*HandlerT) Verbosity Uses

func (*HandlerT) Verbosity(level int)

Verbosity sets the log verbosity ceiling. The verbosity of individual packages and source files can be raised using Vmodule.

func (*HandlerT) Vmodule Uses

func (*HandlerT) Vmodule(pattern string) error

Vmodule sets the log verbosity pattern. See package log for details on the pattern syntax.

func (*HandlerT) WriteBlockProfile Uses

func (*HandlerT) WriteBlockProfile(file string) error

WriteBlockProfile writes a goroutine blocking profile to the given file.

func (*HandlerT) WriteMemProfile Uses

func (*HandlerT) WriteMemProfile(file string) 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.

func (*HandlerT) WriteMutexProfile Uses

func (*HandlerT) WriteMutexProfile(file string) error

WriteMutexProfile writes a goroutine blocking profile to the given file.

Package debug imports 23 packages (graph) and is imported by 265 packages. Updated 2020-10-14. Refresh now. Tools for package owners.