Documentation ¶
Index ¶
- Variables
- func GetCPUNum() int
- func GetCgroupMemoryLimit() (uint64, error)
- func GetCgroupProcessMemoryPercent() (float64, error)
- func GetGoroutineNum() int
- func GetMemoryStat() (total, used, free uint64, usedPercent float64)
- func GetProcessCPUStat() (float64, error)
- func GetProcessMemoryPercent() (float32, error)
- func GetProcessMemoryStat() (uint64, error)
- func GetThreadNum() int
- func GoSafely(wg *sync.WaitGroup, ignoreRecover bool, handler func(), ...)
- func GoUnterminated(handle func(), wg *sync.WaitGroup, ignoreRecover bool, period time.Duration)
- func IsCgroup() bool
Constants ¶
This section is empty.
Variables ¶
var CurrentPID = os.Getpid()
CurrentPID returns the process id of the caller.
Functions ¶
func GetCgroupMemoryLimit ¶ added in v1.9.8
GetCgroupMemoryLimit returns a container's total memory in bytes
func GetCgroupProcessMemoryPercent ¶ added in v1.9.8
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
GetMemoryStat gets current os's memory size in bytes
func GetProcessCPUStat ¶ added in v1.9.8
GetProcessCPUStat gets current process's cpu stat
func GetProcessMemoryPercent ¶ added in v1.9.8
GetProcessMemoryStat gets current process's memory usage percent
func GetProcessMemoryStat ¶ added in v1.9.8
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 ¶
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.
Types ¶
This section is empty.