subsystems

package
v0.0.0-...-2f24515 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2017 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SubSystemsIns = []SubSystem{

		&MemorySubSystem{},
	}
)

Initialize a instance using subsystems.

Functions

func FindCgroupMountpoint

func FindCgroupMountpoint(subsystem string) string

FindCgroupMountpoint returns the mountpoint for given subsystem.

func GetCgroupPath

func GetCgroupPath(subsystem string, cgroupPath string, autoCreate bool) (string, error)

GetCgroupPath returns the path of given cgroup.

Types

type MemorySubSystem

type MemorySubSystem struct{}

MemorySubSystem is the implement of memory subsystem.

func (*MemorySubSystem) Apply

func (s *MemorySubSystem) Apply(cgroupPath string, pid int) error

Apply add a process represented by pid to given cgroup's subsystem.

func (*MemorySubSystem) Name

func (s *MemorySubSystem) Name() string

Name is "memory".

func (*MemorySubSystem) Remove

func (s *MemorySubSystem) Remove(cgroupPath string) error

Remove removes the given cgroup.

func (*MemorySubSystem) Set

func (s *MemorySubSystem) Set(cgroupPath string, res *ResourceConfig) error

Set sets the limit of given cgroup.

type ResourceConfig

type ResourceConfig struct {
	MemoryLimit string
	CPUShare    string
	CPUSet      string
}

ResourceConfig is configs of resources.

type SubSystem

type SubSystem interface {
	Name() string
	Set(path string, res *ResourceConfig) error
	Apply(path string, pid int) error
	Remove(path string) error
}

SubSystem is cgourp subsystem, and path is a cgroup.

Jump to

Keyboard shortcuts

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