gxruntime

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentPID = os.Getpid()

CurrentPID returns the process id of the caller.

Functions

func GetCPUNum added in v1.9.10

func GetCPUNum() int

GetCPUNum gets current os's cpu number

func GetCgroupMemoryLimit added in v1.9.8

func GetCgroupMemoryLimit() (uint64, error)

GetCgroupMemoryLimit returns a container's total memory in bytes

func GetCgroupProcessMemoryPercent added in v1.9.8

func GetCgroupProcessMemoryPercent() (float64, error)

GetCgroupProcessMemoryPercent gets current process's memory usage percent in cgroup env

func GetGoroutineNum added in v1.9.8

func GetGoroutineNum() int

GetGoroutineNum gets current process's goroutine number

func GetMemoryStat added in v1.9.10

func GetMemoryStat() (total, used, free uint64, usedPercent float64)

GetMemoryStat gets current os's memory size in bytes

func GetProcessCPUStat added in v1.9.8

func GetProcessCPUStat() (float64, error)

GetProcessCPUStat gets current process's cpu stat

func GetProcessMemoryPercent added in v1.9.8

func GetProcessMemoryPercent() (float32, error)

GetProcessMemoryStat gets current process's memory usage percent

func GetProcessMemoryStat added in v1.9.8

func GetProcessMemoryStat() (uint64, error)

GetProcessMemoryStat gets current process's memory usage in Byte

func GetThreadNum added in v1.9.8

func GetThreadNum() int

GetThreadNum gets current process's thread number

func GoSafely

func GoSafely(wg *sync.WaitGroup, ignoreRecover bool, handler func(), catchFunc func(r interface{}))

GoSafely wraps a `go func()` with recover()

func GoUnterminated

func GoUnterminated(handle func(), wg *sync.WaitGroup, ignoreRecover bool, period time.Duration)

GoUnterminated is used for which goroutine wanna long live as its process. @period: sleep time duration after panic to defeat @handle panic so frequently. if it is not positive,

the @handle will be invoked asap after panic.

func IsCgroup added in v1.9.10

func IsCgroup() bool

IsCgroup checks whether current os is a container or not

Types

This section is empty.

Jump to

Keyboard shortcuts

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