proc

package
v0.0.0-...-115e584 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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 Env

func Env(name string) string

Env 返回指定环境变量的值

func EnvInt

func EnvInt(name string) (int, bool)

EnvInt 返回整数类型的环境变量的值

func Pid

func Pid() int

Pid 返回当前进程的进程ID

func ProcessName

func ProcessName() string

ProcessName 返回当前进程名

func SetTimeToForceQuit

func SetTimeToForceQuit(duration time.Duration)

SetTimeToForceQuit 设置强制退出前的等待时间

Types

type Profile

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

Profile 代表一个存活的profiling会话

func (*Profile) Stop

func (p *Profile) Stop()

Stop 停止profile并将内存中还未写入文件的数据刷入文件中。

type Stopper

type Stopper interface {
	Stop()
}

Stopper interface 包装Stop方法

func StartProfile

func StartProfile() Stopper

StartProfile 开启一个新的profiling会话 该方法会返回一个Stopper接口,调用者应该在获得返回值后调用Stopper.Stop()终止profiling会话

Jump to

Keyboard shortcuts

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