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 RSS uint64 RSSHuge uint64 MappedFile uint64 Dirty uint64 Writeback uint64 PgPgIn uint64 PgPgOut uint64 PgFault uint64 PgMajFault uint64 InactiveAnon uint64 ActiveAnon uint64 InactiveFile uint64 ActiveFile uint64 Unevictable uint64 HierarchicalMemoryLimit uint64 HierarchicalSwapLimit uint64 TotalCache uint64 TotalRSS uint64 TotalRSSHuge uint64 TotalMappedFile uint64 TotalDirty uint64 TotalWriteback uint64 TotalPgPgIn uint64 TotalPgPgOut uint64 TotalPgFault uint64 TotalPgMajFault uint64 TotalInactiveAnon uint64 TotalActiveAnon uint64 TotalInactiveFile uint64 TotalActiveFile uint64 TotalUnevictable uint64 Usage MemoryEntry Swap MemoryEntry Kernel MemoryEntry KernelTCP MemoryEntry }
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 PidPath ¶
PidPath will return the correct cgroup paths for an existing process running inside a cgroup This is commonly used for the Load function to restore an existing container
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 }