proc

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 15 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 returns the channel that notifies the process quitting.

func Env

func Env(name string) string

Env returns the value of the given environment variable.

func EnvInt

func EnvInt(name string) (int, bool)

EnvInt returns an int value of the given environment variable.

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