cgroups

package
v0.0.0-...-72e9078 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CGroups

type CGroups struct {
	Path string
	// contains filtered or unexported fields
}

func NewCGroup

func NewCGroup() *CGroups

NewCGroup creates an empty CGroups

func (*CGroups) GetPids

func (cg *CGroups) GetPids() ([]int, error)

GetPids returns slice of pids running on CGroups.

func (*CGroups) Load

func (cg *CGroups) Load() error

Load affects CGroups.

func (*CGroups) Remove

func (cg *CGroups) Remove() error

Remove removes CGroups.

It will only works if there is no process running in the CGroups

func (*CGroups) SetCPULimit

func (cg *CGroups) SetCPULimit(quota float64) *CGroups

SetCPULimit sets number of CPU for the CGroups.

func (*CGroups) SetMemorySwapLimit

func (cg *CGroups) SetMemorySwapLimit(memory, swap int) *CGroups

SetMemorySwapLimit sets memory and swap limit for CGroups.

Zero or lower values consider as MAX.

func (*CGroups) SetPath

func (cg *CGroups) SetPath(path string) *CGroups

SetPath sets Path for CGroups.

NOTE: it does not require CGroup base path (/sys/fs/cgroup)

func (*CGroups) SetProcessLimit

func (cg *CGroups) SetProcessLimit(number int) *CGroups

SetProcessLimit sets maximum processes than can be created simultaneously in CGroups.

Jump to

Keyboard shortcuts

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