Documentation
¶
Index ¶
- Constants
- func AddShutdownListener(fn func()) (waitForCalled func())
- func AddWrapUpListener(fn func()) (waitForCalled func())
- func Done() <-chan struct{}
- func Env(name string) string
- func EnvInt(name string) (int, bool)
- func Pid() int
- func ProcessName() string
- func SetTimeToForceQuit(duration time.Duration)
- func Setup(conf ShutdownConf)
- func Shutdown()
- func WrapUp()
- type Profile
- type ShutdownConf
- type Stopper
Constants ¶
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 returns the channel that notifies the process quitting.
func ProcessName ¶
func ProcessName() string
ProcessName returns the processname, same as the command name.
func SetTimeToForceQuit ¶
SetTimeToForceQuit sets the waiting time before force quitting.
func Setup ¶ added in v1.7.5
func Setup(conf ShutdownConf)
Types ¶
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile represents an active profiling session.
type ShutdownConf ¶ added in v1.7.5
type ShutdownConf struct { // WrapUpTime is the time to wait before calling shutdown listeners. WrapUpTime time.Duration `json:",default=1s"` // WaitTime is the time to wait before force quitting. WaitTime time.Duration `json:",default=5.5s"` }
ShutdownConf defines the shutdown configuration for the process.
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.