Documentation ¶
Index ¶
- Constants
- func AddShutdownListener(fn func()) (waitForCalled func())
- func AddWrapUpListener(fn func()) (waitForCalled func())
- func Env(name string) string
- func EnvInt(name string) (int, bool)
- func Pid() int
- func ProcessName() string
- func SetTimeToForceQuit(duration time.Duration)
- type Profile
- type Stopper
Constants ¶
View Source
const DefaultMemProfileRate = 4096
DefaultMemProfileRate 默认内存剖析率(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 添加fn到 shutdownListeners 队列中 返回的waitForCalled函数用于等待传入的fn函数被调用,使用WaitGroup实现的
func AddWrapUpListener ¶
func AddWrapUpListener(fn func()) (waitForCalled func())
AddWrapUpListener 添加fn到 wrapUpListeners 队列中 返回的waitForCalled函数用于等待传入的fn函数被调用,使用WaitGroup实现的
func SetTimeToForceQuit ¶
SetTimeToForceQuit 设置强制退出前的等待时间
Types ¶
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile 代表一个存活的profiling会话
type Stopper ¶
type Stopper interface {
Stop()
}
Stopper interface 包装Stop方法
func StartProfile ¶
func StartProfile() Stopper
StartProfile 开启一个新的profiling会话 该方法会返回一个Stopper接口,调用者应该在获得返回值后调用Stopper.Stop()终止profiling会话
Click to show internal directories.
Click to hide internal directories.