proc

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMemProfileRate = 4096

DefaultMemProfileRate is the default memory profiling rate. See also http://golang.org/pkg/runtime/#pkg-variables

Variables

This section is empty.

Functions

func AddShutdownListener

func AddShutdownListener(fn func()) (waitForCalled func())

AddShutdownListener adds fn as a shutdown listener. The returned func can be used to wait for fn getting called.

func AddWrapUpListener

func AddWrapUpListener(fn func()) (waitForCalled func())

AddWrapUpListener adds fn as a wrap up listener. The returned func can be used to wait for fn getting called.

func Done

func Done() <-chan struct{}

Done 返回一个channel,用于通知进程退出

func DumpGoroutines

func DumpGoroutines(ctor creator)

func GracefulStop

func GracefulStop(signals chan os.Signal, sig syscall.Signal)

func InitSignalHandling

func InitSignalHandling()

InitSignalHandling 初始化信号处理

func Pid

func Pid() int

Pid returns pid of current process.

func ProcessName

func ProcessName() string

ProcessName returns the processname, same as the command name.

func SetTimeToForceQuit

func SetTimeToForceQuit(duration time.Duration)

SetTimeToForceQuit sets the waiting time before force quitting.

func Shutdown

func Shutdown()

Shutdown calls the registered shutdown listeners, only for test purpose.

func WrapUp

func WrapUp()

WrapUp wraps up the process, only for test purpose.

Types

type DefaultProcessor

type DefaultProcessor struct{}

DefaultProcessor 实现了SignalProcessor接口,提供默认信号处理逻辑

func (*DefaultProcessor) ProcessSignal

func (dp *DefaultProcessor) ProcessSignal(signals chan os.Signal, sig os.Signal)

type Profile

type Profile struct {
	// contains filtered or unexported fields
}

Profile represents an active profiling session.

func (*Profile) Stop

func (p *Profile) Stop()

Stop stops the profile and flushes any unwritten data.

type SignalProcessor

type SignalProcessor interface {
	ProcessSignal(chan os.Signal, os.Signal)
}

SignalProcessor 定义了处理特定信号的逻辑的接口

type Stopper

type Stopper interface {
	Stop()
}

Stopper interface wraps the method Stop.

func StartProfile

func StartProfile() Stopper

StartProfile starts a new profiling session. The caller should call the Stop method on the value returned to cleanly stop profiling.

Jump to

Keyboard shortcuts

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