Versions in this module Expand all Collapse all v1 v1.0.2 Jun 26, 2024 Changes in this version + const CgroupNamePrefix + const CgroupProcesses + var ErrDevicesUnsupported = errors.New("cgroup manager is not configured to set device rules") + var ErrV1NoUnified = errors.New("invalid configuration: cannot use unified on cgroup v1") + var TestMode bool + func ConvertBlkIOToIOWeightValue(blkIoWeight uint16) uint64 + func ConvertCPUSharesToCgroupV2Value(cpuShares uint64) uint64 + func ConvertMemorySwapToCgroupV2Value(memorySwap, memory int64) (int64, error) + func FindCgroupMountpoint(cgroupPath, subsystem string) (string, error) + func FindCgroupMountpointAndRoot(cgroupPath, subsystem string) (string, string, error) + func GetAllSubsystems() ([]string, error) + func GetOwnCgroup(subsystem string) (string, error) + func GetOwnCgroupPath(subsystem string) (string, error) + func IsCgroup2UnifiedMode() bool + func IsNotFound(err error) bool + func NewNotFoundError(sub string) error + func OpenFile(dir, file string, flags int) (*os.File, error) + func ParseCgroupFile(path string) (map[string]string, error) + func PathExists(path string) bool + func ReadFile(dir, file string) (string, error) + func RemovePath(path string) error + func RemovePaths(paths map[string]string) (err error) + func WriteCgroupProc(dir string, pid int) error + func WriteFile(dir, file, data string) error + type BlkioStatEntry struct + Major uint64 + Minor uint64 + Op string + Value uint64 + type BlkioStats struct + IoMergedRecursive []BlkioStatEntry + IoQueuedRecursive []BlkioStatEntry + IoServiceBytesRecursive []BlkioStatEntry + IoServiceTimeRecursive []BlkioStatEntry + IoServicedRecursive []BlkioStatEntry + IoTimeRecursive []BlkioStatEntry + IoWaitTimeRecursive []BlkioStatEntry + PSI *PSIStats + SectorsRecursive []BlkioStatEntry + type CPUSetStats struct + CPUExclusive uint64 + CPUs []uint16 + MemExclusive uint64 + MemHardwall uint64 + MemoryMigrate uint64 + MemoryPressure uint64 + MemorySpreadPage uint64 + MemorySpreadSlab uint64 + Mems []uint16 + SchedLoadBalance uint64 + SchedRelaxDomainLevel int64 + type CpuStats struct + CpuUsage CpuUsage + PSI *PSIStats + ThrottlingData ThrottlingData + type CpuUsage struct + PercpuUsage []uint64 + PercpuUsageInKernelmode []uint64 + PercpuUsageInUsermode []uint64 + TotalUsage uint64 + UsageInKernelmode uint64 + UsageInUsermode uint64 + type HugetlbStats struct + Failcnt uint64 + MaxUsage uint64 + Usage uint64 + type Manager interface + Apply func(pid int) error + Destroy func() error + Exists func() bool + Freeze func(state config.FreezerState) error + GetAllPids func() ([]int, error) + GetCgroups func() (*config.Cgroup, error) + GetEffectiveCPUs func() string + GetFreezerState func() (config.FreezerState, error) + GetPaths func() map[string]string + GetPids func() ([]int, error) + GetStats func() (*Stats, error) + OOMKillCount func() (uint64, error) + Path func(string) string + Set func(r *config.Resources) error + type MemoryData struct + Failcnt uint64 + Limit uint64 + MaxUsage uint64 + Usage uint64 + type MemoryStats struct + Cache uint64 + KernelTCPUsage MemoryData + KernelUsage MemoryData + PSI *PSIStats + PageUsageByNUMA PageUsageByNUMA + Stats map[string]uint64 + SwapOnlyUsage MemoryData + SwapUsage MemoryData + Usage MemoryData + UseHierarchy bool + type MiscStats struct + Events uint64 + Usage uint64 + type Mount struct + Mountpoint string + Root string + Subsystems []string + func GetCgroupMounts(all bool) ([]Mount, error) + type NotFoundError struct + Subsystem string + func (e *NotFoundError) Error() string + type PSIData struct + Avg10 float64 + Avg300 float64 + Avg60 float64 + Total uint64 + type PSIStats struct + Full PSIData + Some PSIData + type PageStats struct + Nodes map[uint8]uint64 + Total uint64 + type PageUsageByNUMA struct + Hierarchical PageUsageByNUMAInner + type PageUsageByNUMAInner struct + Anon PageStats + File PageStats + Total PageStats + Unevictable PageStats + type PidsStats struct + Current uint64 + Limit uint64 + type RdmaEntry struct + Device string + HcaHandles uint32 + HcaObjects uint32 + type RdmaStats struct + RdmaCurrent []RdmaEntry + RdmaLimit []RdmaEntry + type Stats struct + BlkioStats BlkioStats + CPUSetStats CPUSetStats + CpuStats CpuStats + HugetlbStats map[string]HugetlbStats + MemoryStats MemoryStats + MiscStats map[string]MiscStats + PidsStats PidsStats + RdmaStats RdmaStats + func NewStats() *Stats + type ThrottlingData struct + Periods uint64 + ThrottledPeriods uint64 + ThrottledTime uint64