Documentation ¶
Index ¶
- Variables
- func FreeOS()
- func GetCPUNum() int
- func GetCgroupMemoryLimit() (uint64, error)
- func GetCgroupProcessMemoryPercent() (float64, error)
- func GetExePath() (exePath string, err error)
- func GetGoroutineNum() int
- func GetHostname() string
- func GetMemoryStat() (total, used, free uint64, usedPercent float64)
- func GetProcessCPUStat() (float64, error)
- func GetProcessMemoryPercent() (float32, error)
- func GetProcessMemoryStat() (uint64, error)
- func GetRoutineId() uint64
- func GetThreadNum() int
- func GetWorkDir() string
- func GoRoutine(function func())
- func GoRoutineInLoop(function func())
- func GoRoutineInTimer(duration time.Duration, function func())
- func GoSafely(wg *sync.WaitGroup, ignoreRecover bool, handler func(), ...)
- func GoUnterminated(handle func(), wg *sync.WaitGroup, ignoreRecover bool, period time.Duration)
- func GoVarLoop(n uint64, function func())
- func IsCgroup() bool
- func IsLittleEndian() bool
- func RegisterSignalForPrintStack(sig os.Signal, callback func([]byte))
- func RegisterSignalForProfiling(sig ...os.Signal)
- func Reload() error
- func SwapEndianUin32(val uint32) uint32
Constants ¶
This section is empty.
Variables ¶
var CurrentPID = os.Getpid()
CurrentPID returns the process id of the caller.
Functions ¶
func GetCgroupMemoryLimit ¶ added in v0.0.6
GetCgroupMemoryLimit returns a container's total memory in bytes
func GetCgroupProcessMemoryPercent ¶ added in v0.0.6
GetCgroupProcessMemoryPercent gets current process's memory usage percent in cgroup env
func GetExePath ¶ added in v0.0.5
func GetGoroutineNum ¶ added in v0.0.6
func GetGoroutineNum() int
GetGoroutineNum gets current process's goroutine number
func GetMemoryStat ¶ added in v0.0.6
func GetProcessCPUStat ¶ added in v0.0.6
GetProcessCPUStat gets current process's cpu stat
func GetProcessMemoryPercent ¶ added in v0.0.6
GetProcessMemoryStat gets current process's memory usage percent
func GetProcessMemoryStat ¶ added in v0.0.6
GetProcessMemoryStat gets current process's memory usage in Byte
func GetRoutineId ¶
func GetRoutineId() uint64
func GetThreadNum ¶ added in v0.0.6
func GetThreadNum() int
func GoRoutineInLoop ¶
func GoRoutineInLoop(function func())
func GoRoutineInTimer ¶
func GoSafely ¶ added in v0.0.6
func GoSafely(wg *sync.WaitGroup, ignoreRecover bool, handler func(), catchFunc func(r interface{}))
GoSafely wraps a `go func()` with recover()
func GoUnterminated ¶ added in v0.0.6
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 v0.0.6
func IsCgroup() bool
IsCgroup checks whether current os is a container or not
func IsLittleEndian ¶
func IsLittleEndian() bool
func SwapEndianUin32 ¶
Types ¶
This section is empty.