Documentation ¶
Overview ¶
Package cgroup provides an interface to read and write configuration to cgroup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidFormat = errors.New("cgroup: parsing file with invalid format failed") ErrInvalidGroupPath = errors.New("cgroup: invalid group path") )
Functions ¶
Types ¶
type Cgroup ¶
type Cgroup interface { Install(res *specs.LinuxResources) error Uninstall() error Join() (func(), error) CPUQuota() (float64, error) CPUUsage() (uint64, error) NumCPU() (int, error) MemoryLimit() (uint64, error) MakePath(controllerName string) string }
Cgroup represents a cgroup configuration.
func NewFromPath ¶
NewFromPath creates a new Cgroup instance from the specified relative path. Cgroup paths are loaded based on the current process.
func NewFromPid ¶
NewFromPid loads cgroup for the given process.
type CgroupJSON ¶
type CgroupJSON struct {
Cgroup Cgroup `json:"cgroup"`
}
CgroupJSON is a wrapper for Cgroup that can be encoded to JSON.
func (*CgroupJSON) MarshalJSON ¶
func (c *CgroupJSON) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.MarshalJSON
func (*CgroupJSON) UnmarshalJSON ¶
func (c *CgroupJSON) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON
Click to show internal directories.
Click to hide internal directories.