Documentation
¶
Index ¶
- Variables
- func IgnoreNotExist(err error) error
- func NewBlkio(root string) *blkioController
- func NewCpu(root string) *cpuController
- func NewCpuacct(root string) *cpuacctController
- func NewCputset(root string) *cpusetController
- func NewDevices(root string) *devicesController
- func NewFreezer(root string) *freezerController
- func NewHugetlb(root string) (*hugetlbController, error)
- func NewMemory(root string) *memoryController
- func NewNamed(root string, name Name) *namedController
- func NewNetCls(root string) *netclsController
- func NewNetPrio(root string) *netprioController
- func NewPids(root string) *pidsController
- func RootPath(subsysem Name) (string, error)
- type BlkioEntry
- type BlkioStat
- type Cgroup
- type CpuStat
- type CpuUsage
- type ErrorHandler
- type Hierarchy
- type HugetlbStat
- type MemoryEntry
- type MemoryStat
- type Name
- type Path
- type PerfEventController
- type PidsStat
- type Process
- type State
- type Stats
- type Subsystem
- type Throttle
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPid = errors.New("cgroups: pid must be greater than 0") ErrMountPointNotExist = errors.New("cgroups: cgroup mountpoint does not exist") ErrInvalidFormat = errors.New("cgroups: parsing file with invalid format failed") ErrFreezerNotSupported = errors.New("cgroups: freezer cgroup not supported on this system") ErrMemoryNotSupported = errors.New("cgroups: memory cgroup not supported on this system") ErrCgroupDeleted = errors.New("cgroups: cgroup deleted") ErrNoCgroupMountDestination = errors.New("cgroups: cannot found cgroup mount destination") )
Functions ¶
func IgnoreNotExist ¶
IgnoreNotExist ignores any errors that are for not existing files
func NewCpuacct ¶
func NewCpuacct(root string) *cpuacctController
func NewCputset ¶
func NewCputset(root string) *cpusetController
func NewDevices ¶
func NewDevices(root string) *devicesController
func NewFreezer ¶
func NewFreezer(root string) *freezerController
func NewHugetlb ¶
func NewNetPrio ¶
func NewNetPrio(root string) *netprioController
Types ¶
type BlkioStat ¶
type BlkioStat struct {
IoServiceBytesRecursive []BlkioEntry
IoServicedRecursive []BlkioEntry
IoQueuedRecursive []BlkioEntry
IoServiceTimeRecursive []BlkioEntry
IoWaitTimeRecursive []BlkioEntry
IoMergedRecursive []BlkioEntry
IoTimeRecursive []BlkioEntry
SectorsRecursive []BlkioEntry
}
type Cgroup ¶
type Cgroup interface {
// New creates a new cgroup under the calling cgroup
New(string, *specs.LinuxResources) (Cgroup, error)
// Add adds a process to the cgroup
Add(Process) error
// Delete removes the cgroup as a whole
Delete() error
// MoveTo moves all the processes under the calling cgroup to the provided one
// subsystems are moved one at a time
MoveTo(Cgroup) error
// Stat returns the stats for all subsystems in the cgroup
Stat(...ErrorHandler) (*Stats, error)
// Update updates all the subsystems with the provided resource changes
Update(resources *specs.LinuxResources) error
// Processes returns all the processes in a select subsystem for the cgroup
Processes(Name, bool) ([]Process, error)
// Freeze freezes or pauses all processes inside the cgroup
Freeze() error
// Thaw thaw or resumes all processes inside the cgroup
Thaw() error
// OOMEventFD returns the memory subsystem's event fd for OOM events
OOMEventFD() (uintptr, error)
// State returns the cgroups current state
State() State
// Subsystems returns all the subsystems in the cgroup
Subsystems() []Subsystem
}
Cgroup handles interactions with the individual groups to perform actions on them as them main interface to this cgroup package
type ErrorHandler ¶
ErrorHandler is a function that handles and acts on errors
type Hierarchy ¶
Hierarchy enableds both unified and split hierarchy for cgroups
func SingleSubsystem ¶
SingleSubsystem returns a single cgroup subsystem within the base Hierarchy
type HugetlbStat ¶
type MemoryStat ¶
type MemoryStat struct {
Cache uint64
Usage MemoryEntry
Swap MemoryEntry
Kernel MemoryEntry
KernelTCP MemoryEntry
Raw map[string]uint64
}
type Name ¶
type Name string
Name is a typed name for a cgroup subsystem
func Subsystems ¶
func Subsystems() []Name
Subsystems returns a complete list of the default cgroups avaliable on most linux systems
type Path ¶
func NestedPath ¶
NestedPath will nest the cgroups based on the calling processes cgroup placing its child processes inside its own path
func StaticPath ¶
StaticPath returns a static path to use for all cgroups
type PerfEventController ¶
type PerfEventController struct {
// contains filtered or unexported fields
}
func NewPerfEvent ¶
func NewPerfEvent(root string) *PerfEventController
func (*PerfEventController) Name ¶
func (p *PerfEventController) Name() Name
func (*PerfEventController) Path ¶
func (p *PerfEventController) Path(path string) string
type Stats ¶
type Stats struct {
Hugetlb map[string]HugetlbStat
Pids *PidsStat
Cpu *CpuStat
Memory *MemoryStat
Blkio *BlkioStat
// contains filtered or unexported fields
}