Documentation ¶
Index ¶
- Constants
- Variables
- func GetMemTotal(filePath string) (uint64, error)
- func GetMemoryLimitInBytes(filePath string) (uint64, error)
- func GetTotal(filePath string) (uint64, error)
- func GetV1DefaultMaxValue() string
- func IsCgroupV2(basePath string) bool
- func ReadIntegerValueCgroupFile(filename string) (uint64, error)
- func ReadLines(filename string) ([]string, error)
- func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)
- func ReadSingleValueCgroupFile(filename string) (string, error)
- type CgroupCPU
- type CgroupMem
- type CgroupSource
- type CgroupSwap
- type DockerCpuPercentages
- type DockerCpuTimes
- type MemoryStat
Constants ¶
View Source
const ( CgroupBasePath = "/sys/fs/cgroup/" V1CpuacctStatFile = "cpuacct/cpuacct.stat" V1CpuStatFile = "cpu/cpu.stat" V1CpuPeriodFile = "cpu/cpu.cfs_period_us" V1CpuQuotaFile = "cpu/cpu.cfs_quota_us" V1CpusetCpusFile = "cpuset/cpuset.cpus" V1MemStatFile = "memory/memory.stat" V1MemTotalFile = "memory/memory.limit_in_bytes" V1MemUsageFile = "memory/memory.usage_in_bytes" V1OutOfMemoryControlFile = "memory/memory.oom_control" V1SwapTotalFile = "memory/memory.memsw.limit_in_bytes" V1SwapUsageFile = "memory/memory.memsw.usage_in_bytes" V1UserKey = "user" V1SystemKey = "system" V1CachedKey = "cache" V1ThrottlingTimeKey = "throttled_time" V1ThrottlingThrottledKey = "nr_throttled" V1ThrottlingPeriodsKey = "nr_periods" V1OutOfMemoryKey = "under_oom" V1OutOfMemoryKillKey = "oom_kill" V2CpuStatFile = "cpu.stat" V2CpuWeightFile = "cpu.weight" V2CpuMaxFile = "cpu.max" V2CpusetCpusFile = "cpuset.cpus" V2MemStatFile = "memory.stat" V2MemTotalFile = "memory.max" V2MemUsageFile = "memory.current" V2MemEventsFile = "memory.events" V2SwapTotalFile = "memory.swap.max" V2SwapUsageFile = "memory.swap.current" V2UserKey = "user_usec" V2SystemKey = "system_usec" V2CachedKey = "file" V2ThrottlingTimeKey = "throttled_usec" V2ThrottlingThrottledKey = "nr_throttled" V2ThrottlingPeriodsKey = "nr_periods" V2OutOfMemoryKey = "oom" V2OutOfMemoryKillKey = "oom_kill" V2DefaultMaxValue = "max" )
Variables ¶
View Source
var ( CpuStatsPath = "/proc/stat" GetNumberOfCores = runtime.NumCPU )
Functions ¶
func GetMemTotal ¶
If no memory limit is set for docker container, then memTotal is set to zero and total is set to the host's swap memory total
func GetMemoryLimitInBytes ¶
func GetV1DefaultMaxValue ¶
func GetV1DefaultMaxValue() string
func IsCgroupV2 ¶
func ReadLinesOffsetN ¶
Types ¶
type CgroupCPU ¶
type CgroupCPU struct {
// contains filtered or unexported fields
}
func NewCgroupCPUSource ¶
func (*CgroupCPU) Percentages ¶
func (cgroupCPU *CgroupCPU) Percentages() (DockerCpuPercentages, error)
type CgroupMem ¶
type CgroupMem struct {
// contains filtered or unexported fields
}
func NewCgroupMemSource ¶
func (*CgroupMem) VirtualMemoryStat ¶
func (cgroupMem *CgroupMem) VirtualMemoryStat() (*mem.VirtualMemoryStat, error)
func (*CgroupMem) VirtualMemoryStatWithContext ¶ added in v2.28.0
type CgroupSource ¶
type CgroupSource interface {
Stats() float64
}
type CgroupSwap ¶
type CgroupSwap struct {
// contains filtered or unexported fields
}
func NewCgroupSwapSource ¶
func NewCgroupSwapSource(basePath string) *CgroupSwap
func (*CgroupSwap) SwapMemoryStat ¶
func (cgroupSwap *CgroupSwap) SwapMemoryStat() (*mem.SwapMemoryStat, error)
type DockerCpuPercentages ¶
type DockerCpuTimes ¶
type DockerCpuTimes struct {
// contains filtered or unexported fields
}
type MemoryStat ¶
type MemoryStat struct {
// contains filtered or unexported fields
}
func GetMemoryStat ¶
func GetMemoryStat(statFile string, cachedKey string, sharedKey string) (MemoryStat, error)
Click to show internal directories.
Click to hide internal directories.