cgroups

package
v0.0.0-...-09d837b Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AbsCgroupPath is absolute path for container's cgroup mount
	AbsCgroupPath = "/cgrouptest"
	// RelCgroupPath is relative path for container's cgroup mount
	RelCgroupPath = "testdir/cgrouptest/container"
)
View Source
var HugePageSizeUnitList = []string{"B", "KB", "MB", "GB", "TB", "PB"}

HugePageSizeUnitList is a list of the units used by the linux kernel when naming the HugePage control files. https://www.kernel.org/doc/Documentation/cgroup-v1/hugetlb.txt

Functions

func GetBlockIOData

func GetBlockIOData(pid int, cgPath string) (*rspec.LinuxBlockIO, error)

GetBlockIOData gets cgroup blockio data

func GetCPUData

func GetCPUData(pid int, cgPath string) (*rspec.LinuxCPU, error)

GetCPUData gets cgroup cpus data

func GetDevicesData

func GetDevicesData(pid int, cgPath string) ([]rspec.LinuxDeviceCgroup, error)

GetDevicesData gets cgroup devices data

func GetHugePageSize

func GetHugePageSize() ([]string, error)

GetHugePageSize returns a list of the supported Hugepage sizes on the same format as opencontainers/runtime-spec (see pageSize): https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#huge-page-limits eg. ["64KB", "2MB", "1GB"]

func GetHugepageLimitData

func GetHugepageLimitData(pid int, cgPath string) ([]rspec.LinuxHugepageLimit, error)

GetHugepageLimitData gets cgroup hugetlb data

func GetNetworkData

func GetNetworkData(pid int, cgPath string) (*rspec.LinuxNetwork, error)

GetNetworkData gets cgroup network data

func GetPidsData

func GetPidsData(pid int, cgPath string) (*rspec.LinuxPids, error)

GetPidsData gets cgroup pid ints data

func GetSubsystemPath

func GetSubsystemPath(pid int, subsystem string) (string, error)

GetSubsystemPath gets path of subsystem

Types

type Cgroup

type Cgroup interface {
	GetBlockIOData(pid int, cgPath string) (*rspec.LinuxBlockIO, error)
	GetCPUData(pid int, cgPath string) (*rspec.LinuxCPU, error)
	GetDevicesData(pid int, cgPath string) ([]rspec.LinuxDeviceCgroup, error)
	GetHugepageLimitData(pid int, cgPath string) ([]rspec.LinuxHugepageLimit, error)
	GetMemoryData(pid int, cgPath string) (*rspec.LinuxMemory, error)
	GetNetworkData(pid int, cgPath string) (*rspec.LinuxNetwork, error)
	GetPidsData(pid int, cgPath string) (*rspec.LinuxPids, error)
}

Cgroup represents interfaces for cgroup validation

func FindCgroup

func FindCgroup() (Cgroup, error)

FindCgroup gets cgroup root mountpoint

type CgroupV1

type CgroupV1 struct {
	MountPath string
}

CgroupV1 used for cgroupv1 validation

func (*CgroupV1) GetBlockIOData

func (cg *CgroupV1) GetBlockIOData(pid int, cgPath string) (*rspec.LinuxBlockIO, error)

GetBlockIOData gets cgroup blockio data

func (*CgroupV1) GetCPUData

func (cg *CgroupV1) GetCPUData(pid int, cgPath string) (*rspec.LinuxCPU, error)

GetCPUData gets cgroup cpus data

func (*CgroupV1) GetDevicesData

func (cg *CgroupV1) GetDevicesData(pid int, cgPath string) ([]rspec.LinuxDeviceCgroup, error)

GetDevicesData gets cgroup devices data

func (*CgroupV1) GetHugepageLimitData

func (cg *CgroupV1) GetHugepageLimitData(pid int, cgPath string) ([]rspec.LinuxHugepageLimit, error)

GetHugepageLimitData gets cgroup hugetlb data

func (*CgroupV1) GetMemoryData

func (cg *CgroupV1) GetMemoryData(pid int, cgPath string) (*rspec.LinuxMemory, error)

GetMemoryData gets cgroup memory data

func (*CgroupV1) GetNetworkData

func (cg *CgroupV1) GetNetworkData(pid int, cgPath string) (*rspec.LinuxNetwork, error)

GetNetworkData gets cgroup network data

func (*CgroupV1) GetPidsData

func (cg *CgroupV1) GetPidsData(pid int, cgPath string) (*rspec.LinuxPids, error)

GetPidsData gets cgroup pids data

type CgroupV2

type CgroupV2 struct {
	MountPath string
}

CgroupV2 used for cgroupv2 validation

func (*CgroupV2) GetMemoryData

func (cg *CgroupV2) GetMemoryData(pid int, cgPath string) (*rspec.LinuxMemory, error)

GetMemoryData gets cgroup memory data

Jump to

Keyboard shortcuts

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