cgroups

package
v0.0.0-...-fd18712 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

View Source
const (
	GoodCgroupName = "good"
	BadCgroupName  = "bad"
	InitCgroupName = "init"
	Unified        = "unified"
)
View Source
const (
	Root   = "/sys/fs/cgroup"
	Garden = "garden"
	Header = "#subsys_name hierarchy num_cgroups enabled"
)

Variables

This section is empty.

Functions

func ConvertCPUSharesToCgroupV2Value

func ConvertCPUSharesToCgroupV2Value(cpuShares uint64) uint64

func IsCgroup2UnifiedMode

func IsCgroup2UnifiedMode() bool

Types

type CPUCgrouper

type CPUCgrouper struct {
	// contains filtered or unexported fields
}

func NewCPUCgrouper

func NewCPUCgrouper(cgroupRoot string) CPUCgrouper

func (CPUCgrouper) CleanupCgroups

func (c CPUCgrouper) CleanupCgroups(handle string) error

func (CPUCgrouper) PrepareCgroups

func (c CPUCgrouper) PrepareCgroups(handle string) error

func (CPUCgrouper) ReadTotalCgroupUsage

func (c CPUCgrouper) ReadTotalCgroupUsage(handle string, containerCPUStats garden.ContainerCPUStat) (garden.ContainerCPUStat, error)

type CgroupStarter

type CgroupStarter struct {
	CgroupPath      string
	GardenCgroup    string
	AllowedDevices  []specs.LinuxDeviceCgroup
	ProcCgroups     io.ReadCloser
	ProcSelfCgroups io.ReadCloser
	CPUThrottling   bool

	Logger            lager.Logger
	MountPointChecker rundmc.MountPointChecker
	FS                fs.FS
	// contains filtered or unexported fields
}

func NewStarter

func NewStarter(
	logger lager.Logger,
	procCgroupReader io.ReadCloser,
	procSelfCgroupReader io.ReadCloser,
	cgroupMountpoint string,
	gardenCgroup string,
	allowedDevices []specs.LinuxDeviceCgroup,
	mountPointChecker rundmc.MountPointChecker,
	enableCPUThrottling bool,
) *CgroupStarter

func (*CgroupStarter) Start

func (s *CgroupStarter) Start() error

func (*CgroupStarter) WithGID

func (s *CgroupStarter) WithGID(gid int) *CgroupStarter

func (*CgroupStarter) WithUID

func (s *CgroupStarter) WithUID(uid int) *CgroupStarter

type CgroupsFormatError

type CgroupsFormatError struct {
	Content string
}

func (CgroupsFormatError) Error

func (err CgroupsFormatError) Error() string

type DefaultCgrouper

type DefaultCgrouper struct {
	// contains filtered or unexported fields
}

func NewDefaultCgrouper

func NewDefaultCgrouper(cgroupRoot string) DefaultCgrouper

func (DefaultCgrouper) CleanupCgroups

func (c DefaultCgrouper) CleanupCgroups(handle string) error

func (DefaultCgrouper) PrepareCgroups

func (c DefaultCgrouper) PrepareCgroups(handle string) error

func (DefaultCgrouper) ReadTotalCgroupUsage

func (DefaultCgrouper) ReadTotalCgroupUsage(_ string, cpuStats garden.ContainerCPUStat) (garden.ContainerCPUStat, error)

Directories

Path Synopsis
fs
fsfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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