cgroups

package module
v0.0.0-...-f7dd103 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2017 License: Apache-2.0 Imports: 23 Imported by: 0

README

cgroups

Build Status

codecov

Go package for creating, managing, inspecting, and destroying cgroups. The resources format for settings on the cgroup uses the OCI runtime-spec found here.

Examples

Create a new cgroup

This creates a new cgroup using a static path for all subsystems under /test.

  • /sys/fs/cgroup/cpu/test
  • /sys/fs/cgroup/memory/test
  • etc....

It uses a single hierarchy and specifies cpu shares as a resource constraint and uses the v1 implementation of cgroups.

shares := uint64(100)
control, err := cgroups.New(cgroups.V1, cgroups.StaticPath("/test"), &specs.LinuxResources{
    CPU: &specs.CPU{
        Shares: &shares,
    },
})
defer control.Delete()
Create with systemd slice support
control, err := cgroups.New(cgroups.Systemd, cgroups.Slice("system.slice", "runc-test"), &specs.LinuxResources{
    CPU: &specs.CPU{
        Shares: &shares,
    },
})

Load an existing cgroup
control, err = cgroups.Load(cgroups.V1, cgroups.StaticPath("/test"))
Add a process to the cgroup
if err := control.Add(cgroups.Process{Pid:1234}); err != nil {
}
Update the cgroup

To update the resources applied in the cgroup

shares = uint64(200)
if err := control.Update(&specs.LinuxResources{
    CPU: &specs.CPU{
        Shares: &shares,
    },
}); err != nil {
}
Freeze and Thaw the cgroup
if err := control.Freeze(); err != nil {
}
if err := control.Thaw(); err != nil {
}
List all processes in the cgroup or recursively
processes, err := control.Processes(cgroups.Devices, recursive)
Get Stats on the cgroup
stats, err := control.Stat()

By adding cgroups.IgnoreNotExist all non-existent files will be ignored, e.g. swap memory stats without swap enabled

stats, err := control.Stat(cgroups.IgnoreNotExist)
Move process across cgroups

This allows you to take processes from one cgroup and move them to another.

err := control.MoveTo(destination)
Create subcgroup
subCgroup, err := control.New("child", resources)

Documentation

Overview

Package cgroups is a generated protocol buffer package.

It is generated from these files:

github.com/containerd/cgroups/metrics.proto

It has these top-level messages:

Metrics
HugetlbStat
PidsStat
CPUStat
CPUUsage
Throttle
MemoryStat
MemoryEntry
BlkIOStat
BlkIOEntry

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var (
	ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMetrics   = fmt.Errorf("proto: integer overflow")
)

Functions

func IgnoreNotExist

func IgnoreNotExist(err error) error

IgnoreNotExist ignores any errors that are for not existing files

func NewBlkio

func NewBlkio(root string) *blkioController

func NewCpu

func NewCpu(root string) *cpuController

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 NewHugetlb(root string) (*hugetlbController, error)

func NewMemory

func NewMemory(root string) *memoryController

func NewNamed

func NewNamed(root string, name Name) *namedController

func NewNetCls

func NewNetCls(root string) *netclsController

func NewNetPrio

func NewNetPrio(root string) *netprioController

func NewPids

func NewPids(root string) *pidsController

func RootPath

func RootPath(subsysem Name) (string, error)

Types

type BlkIOEntry

type BlkIOEntry struct {
	Op     string `protobuf:"bytes,1,opt,name=op,proto3" json:"op,omitempty"`
	Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"`
	Major  uint64 `protobuf:"varint,3,opt,name=major,proto3" json:"major,omitempty"`
	Minor  uint64 `protobuf:"varint,4,opt,name=minor,proto3" json:"minor,omitempty"`
	Value  uint64 `protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"`
}

func (*BlkIOEntry) Descriptor

func (*BlkIOEntry) Descriptor() ([]byte, []int)

func (*BlkIOEntry) Marshal

func (m *BlkIOEntry) Marshal() (dAtA []byte, err error)

func (*BlkIOEntry) MarshalTo

func (m *BlkIOEntry) MarshalTo(dAtA []byte) (int, error)

func (*BlkIOEntry) ProtoMessage

func (*BlkIOEntry) ProtoMessage()

func (*BlkIOEntry) Reset

func (m *BlkIOEntry) Reset()

func (*BlkIOEntry) Size

func (m *BlkIOEntry) Size() (n int)

func (*BlkIOEntry) String

func (this *BlkIOEntry) String() string

func (*BlkIOEntry) Unmarshal

func (m *BlkIOEntry) Unmarshal(dAtA []byte) error

type BlkIOStat

type BlkIOStat struct {
	IoServiceBytesRecursive []*BlkIOEntry `` /* 127-byte string literal not displayed */
	IoServicedRecursive     []*BlkIOEntry `protobuf:"bytes,2,rep,name=io_serviced_recursive,json=ioServicedRecursive" json:"io_serviced_recursive,omitempty"`
	IoQueuedRecursive       []*BlkIOEntry `protobuf:"bytes,3,rep,name=io_queued_recursive,json=ioQueuedRecursive" json:"io_queued_recursive,omitempty"`
	IoServiceTimeRecursive  []*BlkIOEntry `protobuf:"bytes,4,rep,name=io_service_time_recursive,json=ioServiceTimeRecursive" json:"io_service_time_recursive,omitempty"`
	IoWaitTimeRecursive     []*BlkIOEntry `protobuf:"bytes,5,rep,name=io_wait_time_recursive,json=ioWaitTimeRecursive" json:"io_wait_time_recursive,omitempty"`
	IoMergedRecursive       []*BlkIOEntry `protobuf:"bytes,6,rep,name=io_merged_recursive,json=ioMergedRecursive" json:"io_merged_recursive,omitempty"`
	IoTimeRecursive         []*BlkIOEntry `protobuf:"bytes,7,rep,name=io_time_recursive,json=ioTimeRecursive" json:"io_time_recursive,omitempty"`
	SectorsRecursive        []*BlkIOEntry `protobuf:"bytes,8,rep,name=sectors_recursive,json=sectorsRecursive" json:"sectors_recursive,omitempty"`
}

func (*BlkIOStat) Descriptor

func (*BlkIOStat) Descriptor() ([]byte, []int)

func (*BlkIOStat) Marshal

func (m *BlkIOStat) Marshal() (dAtA []byte, err error)

func (*BlkIOStat) MarshalTo

func (m *BlkIOStat) MarshalTo(dAtA []byte) (int, error)

func (*BlkIOStat) ProtoMessage

func (*BlkIOStat) ProtoMessage()

func (*BlkIOStat) Reset

func (m *BlkIOStat) Reset()

func (*BlkIOStat) Size

func (m *BlkIOStat) Size() (n int)

func (*BlkIOStat) String

func (this *BlkIOStat) String() string

func (*BlkIOStat) Unmarshal

func (m *BlkIOStat) Unmarshal(dAtA []byte) error

type CPUStat

type CPUStat struct {
	Usage      *CPUUsage `protobuf:"bytes,1,opt,name=usage" json:"usage,omitempty"`
	Throttling *Throttle `protobuf:"bytes,2,opt,name=throttling" json:"throttling,omitempty"`
}

func (*CPUStat) Descriptor

func (*CPUStat) Descriptor() ([]byte, []int)

func (*CPUStat) Marshal

func (m *CPUStat) Marshal() (dAtA []byte, err error)

func (*CPUStat) MarshalTo

func (m *CPUStat) MarshalTo(dAtA []byte) (int, error)

func (*CPUStat) ProtoMessage

func (*CPUStat) ProtoMessage()

func (*CPUStat) Reset

func (m *CPUStat) Reset()

func (*CPUStat) Size

func (m *CPUStat) Size() (n int)

func (*CPUStat) String

func (this *CPUStat) String() string

func (*CPUStat) Unmarshal

func (m *CPUStat) Unmarshal(dAtA []byte) error

type CPUUsage

type CPUUsage struct {
	// values in nanoseconds
	Total  uint64   `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	Kernel uint64   `protobuf:"varint,2,opt,name=kernel,proto3" json:"kernel,omitempty"`
	User   uint64   `protobuf:"varint,3,opt,name=user,proto3" json:"user,omitempty"`
	PerCPU []uint64 `protobuf:"varint,4,rep,packed,name=per_cpu,json=perCpu" json:"per_cpu,omitempty"`
}

func (*CPUUsage) Descriptor

func (*CPUUsage) Descriptor() ([]byte, []int)

func (*CPUUsage) Marshal

func (m *CPUUsage) Marshal() (dAtA []byte, err error)

func (*CPUUsage) MarshalTo

func (m *CPUUsage) MarshalTo(dAtA []byte) (int, error)

func (*CPUUsage) ProtoMessage

func (*CPUUsage) ProtoMessage()

func (*CPUUsage) Reset

func (m *CPUUsage) Reset()

func (*CPUUsage) Size

func (m *CPUUsage) Size() (n int)

func (*CPUUsage) String

func (this *CPUUsage) String() string

func (*CPUUsage) Unmarshal

func (m *CPUUsage) Unmarshal(dAtA []byte) error

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) (*Metrics, 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

func Load

func Load(hierarchy Hierarchy, path Path) (Cgroup, error)

Load will load an existing cgroup and allow it to be controlled

func New

func New(hierarchy Hierarchy, path Path, resources *specs.LinuxResources) (Cgroup, error)

New returns a new control via the cgroup cgroups interface

type ErrorHandler

type ErrorHandler func(err error) error

ErrorHandler is a function that handles and acts on errors

type Hierarchy

type Hierarchy func() ([]Subsystem, error)

Hierarchy enableds both unified and split hierarchy for cgroups

func SingleSubsystem

func SingleSubsystem(baseHierarchy Hierarchy, subsystem Name) Hierarchy

SingleSubsystem returns a single cgroup subsystem within the base Hierarchy

type HugetlbStat

type HugetlbStat struct {
	Usage    uint64 `protobuf:"varint,1,opt,name=usage,proto3" json:"usage,omitempty"`
	Max      uint64 `protobuf:"varint,2,opt,name=max,proto3" json:"max,omitempty"`
	Failcnt  uint64 `protobuf:"varint,3,opt,name=failcnt,proto3" json:"failcnt,omitempty"`
	Pagesize string `protobuf:"bytes,4,opt,name=pagesize,proto3" json:"pagesize,omitempty"`
}

func (*HugetlbStat) Descriptor

func (*HugetlbStat) Descriptor() ([]byte, []int)

func (*HugetlbStat) Marshal

func (m *HugetlbStat) Marshal() (dAtA []byte, err error)

func (*HugetlbStat) MarshalTo

func (m *HugetlbStat) MarshalTo(dAtA []byte) (int, error)

func (*HugetlbStat) ProtoMessage

func (*HugetlbStat) ProtoMessage()

func (*HugetlbStat) Reset

func (m *HugetlbStat) Reset()

func (*HugetlbStat) Size

func (m *HugetlbStat) Size() (n int)

func (*HugetlbStat) String

func (this *HugetlbStat) String() string

func (*HugetlbStat) Unmarshal

func (m *HugetlbStat) Unmarshal(dAtA []byte) error

type MemoryEntry

type MemoryEntry struct {
	Limit   uint64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
	Usage   uint64 `protobuf:"varint,2,opt,name=usage,proto3" json:"usage,omitempty"`
	Max     uint64 `protobuf:"varint,3,opt,name=max,proto3" json:"max,omitempty"`
	Failcnt uint64 `protobuf:"varint,4,opt,name=failcnt,proto3" json:"failcnt,omitempty"`
}

func (*MemoryEntry) Descriptor

func (*MemoryEntry) Descriptor() ([]byte, []int)

func (*MemoryEntry) Marshal

func (m *MemoryEntry) Marshal() (dAtA []byte, err error)

func (*MemoryEntry) MarshalTo

func (m *MemoryEntry) MarshalTo(dAtA []byte) (int, error)

func (*MemoryEntry) ProtoMessage

func (*MemoryEntry) ProtoMessage()

func (*MemoryEntry) Reset

func (m *MemoryEntry) Reset()

func (*MemoryEntry) Size

func (m *MemoryEntry) Size() (n int)

func (*MemoryEntry) String

func (this *MemoryEntry) String() string

func (*MemoryEntry) Unmarshal

func (m *MemoryEntry) Unmarshal(dAtA []byte) error

type MemoryStat

type MemoryStat struct {
	Cache                   uint64       `protobuf:"varint,1,opt,name=cache,proto3" json:"cache,omitempty"`
	RSS                     uint64       `protobuf:"varint,2,opt,name=rss,proto3" json:"rss,omitempty"`
	RSSHuge                 uint64       `protobuf:"varint,3,opt,name=rss_huge,json=rssHuge,proto3" json:"rss_huge,omitempty"`
	MappedFile              uint64       `protobuf:"varint,4,opt,name=mapped_file,json=mappedFile,proto3" json:"mapped_file,omitempty"`
	Dirty                   uint64       `protobuf:"varint,5,opt,name=dirty,proto3" json:"dirty,omitempty"`
	Writeback               uint64       `protobuf:"varint,6,opt,name=writeback,proto3" json:"writeback,omitempty"`
	PgPgIn                  uint64       `protobuf:"varint,7,opt,name=pg_pg_in,json=pgPgIn,proto3" json:"pg_pg_in,omitempty"`
	PgPgOut                 uint64       `protobuf:"varint,8,opt,name=pg_pg_out,json=pgPgOut,proto3" json:"pg_pg_out,omitempty"`
	PgFault                 uint64       `protobuf:"varint,9,opt,name=pg_fault,json=pgFault,proto3" json:"pg_fault,omitempty"`
	PgMajFault              uint64       `protobuf:"varint,10,opt,name=pg_maj_fault,json=pgMajFault,proto3" json:"pg_maj_fault,omitempty"`
	InactiveAnon            uint64       `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon,proto3" json:"inactive_anon,omitempty"`
	ActiveAnon              uint64       `protobuf:"varint,12,opt,name=active_anon,json=activeAnon,proto3" json:"active_anon,omitempty"`
	InactiveFile            uint64       `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile,proto3" json:"inactive_file,omitempty"`
	ActiveFile              uint64       `protobuf:"varint,14,opt,name=active_file,json=activeFile,proto3" json:"active_file,omitempty"`
	Unevictable             uint64       `protobuf:"varint,15,opt,name=unevictable,proto3" json:"unevictable,omitempty"`
	HierarchicalMemoryLimit uint64       `` /* 134-byte string literal not displayed */
	HierarchicalSwapLimit   uint64       `` /* 128-byte string literal not displayed */
	TotalCache              uint64       `protobuf:"varint,18,opt,name=total_cache,json=totalCache,proto3" json:"total_cache,omitempty"`
	TotalRSS                uint64       `protobuf:"varint,19,opt,name=total_rss,json=totalRss,proto3" json:"total_rss,omitempty"`
	TotalRSSHuge            uint64       `protobuf:"varint,20,opt,name=total_rss_huge,json=totalRssHuge,proto3" json:"total_rss_huge,omitempty"`
	TotalMappedFile         uint64       `protobuf:"varint,21,opt,name=total_mapped_file,json=totalMappedFile,proto3" json:"total_mapped_file,omitempty"`
	TotalDirty              uint64       `protobuf:"varint,22,opt,name=total_dirty,json=totalDirty,proto3" json:"total_dirty,omitempty"`
	TotalWriteback          uint64       `protobuf:"varint,23,opt,name=total_writeback,json=totalWriteback,proto3" json:"total_writeback,omitempty"`
	TotalPgPgIn             uint64       `protobuf:"varint,24,opt,name=total_pg_pg_in,json=totalPgPgIn,proto3" json:"total_pg_pg_in,omitempty"`
	TotalPgPgOut            uint64       `protobuf:"varint,25,opt,name=total_pg_pg_out,json=totalPgPgOut,proto3" json:"total_pg_pg_out,omitempty"`
	TotalPgFault            uint64       `protobuf:"varint,26,opt,name=total_pg_fault,json=totalPgFault,proto3" json:"total_pg_fault,omitempty"`
	TotalPgMajFault         uint64       `protobuf:"varint,27,opt,name=total_pg_maj_fault,json=totalPgMajFault,proto3" json:"total_pg_maj_fault,omitempty"`
	TotalInactiveAnon       uint64       `protobuf:"varint,28,opt,name=total_inactive_anon,json=totalInactiveAnon,proto3" json:"total_inactive_anon,omitempty"`
	TotalActiveAnon         uint64       `protobuf:"varint,29,opt,name=total_active_anon,json=totalActiveAnon,proto3" json:"total_active_anon,omitempty"`
	TotalInactiveFile       uint64       `protobuf:"varint,30,opt,name=total_inactive_file,json=totalInactiveFile,proto3" json:"total_inactive_file,omitempty"`
	TotalActiveFile         uint64       `protobuf:"varint,31,opt,name=total_active_file,json=totalActiveFile,proto3" json:"total_active_file,omitempty"`
	TotalUnevictable        uint64       `protobuf:"varint,32,opt,name=total_unevictable,json=totalUnevictable,proto3" json:"total_unevictable,omitempty"`
	Usage                   *MemoryEntry `protobuf:"bytes,33,opt,name=usage" json:"usage,omitempty"`
	Swap                    *MemoryEntry `protobuf:"bytes,34,opt,name=swap" json:"swap,omitempty"`
	Kernel                  *MemoryEntry `protobuf:"bytes,35,opt,name=kernel" json:"kernel,omitempty"`
	KernelTCP               *MemoryEntry `protobuf:"bytes,36,opt,name=kernel_tcp,json=kernelTcp" json:"kernel_tcp,omitempty"`
}

func (*MemoryStat) Descriptor

func (*MemoryStat) Descriptor() ([]byte, []int)

func (*MemoryStat) Marshal

func (m *MemoryStat) Marshal() (dAtA []byte, err error)

func (*MemoryStat) MarshalTo

func (m *MemoryStat) MarshalTo(dAtA []byte) (int, error)

func (*MemoryStat) ProtoMessage

func (*MemoryStat) ProtoMessage()

func (*MemoryStat) Reset

func (m *MemoryStat) Reset()

func (*MemoryStat) Size

func (m *MemoryStat) Size() (n int)

func (*MemoryStat) String

func (this *MemoryStat) String() string

func (*MemoryStat) Unmarshal

func (m *MemoryStat) Unmarshal(dAtA []byte) error

type Metrics

type Metrics struct {
	Hugetlb []*HugetlbStat `protobuf:"bytes,1,rep,name=hugetlb" json:"hugetlb,omitempty"`
	Pids    *PidsStat      `protobuf:"bytes,2,opt,name=pids" json:"pids,omitempty"`
	CPU     *CPUStat       `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"`
	Memory  *MemoryStat    `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"`
	Blkio   *BlkIOStat     `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"`
}

func (*Metrics) Descriptor

func (*Metrics) Descriptor() ([]byte, []int)

func (*Metrics) Marshal

func (m *Metrics) Marshal() (dAtA []byte, err error)

func (*Metrics) MarshalTo

func (m *Metrics) MarshalTo(dAtA []byte) (int, error)

func (*Metrics) ProtoMessage

func (*Metrics) ProtoMessage()

func (*Metrics) Reset

func (m *Metrics) Reset()

func (*Metrics) Size

func (m *Metrics) Size() (n int)

func (*Metrics) String

func (this *Metrics) String() string

func (*Metrics) Unmarshal

func (m *Metrics) Unmarshal(dAtA []byte) error

type Name

type Name string

Name is a typed name for a cgroup subsystem

const (
	Devices   Name = "devices"
	Hugetlb   Name = "hugetlb"
	Freezer   Name = "freezer"
	Pids      Name = "pids"
	NetCLS    Name = "net_cls"
	NetPrio   Name = "net_prio"
	PerfEvent Name = "perf_event"
	Cpuset    Name = "cpuset"
	Cpu       Name = "cpu"
	Cpuacct   Name = "cpuacct"
	Memory    Name = "memory"
	Blkio     Name = "blkio"
)
const (
	SystemdDbus Name = "systemd"
)

func Subsystems

func Subsystems() []Name

Subsystems returns a complete list of the default cgroups avaliable on most linux systems

type Path

type Path func(subsystem Name) (string, error)

func NestedPath

func NestedPath(suffix string) Path

NestedPath will nest the cgroups based on the calling processes cgroup placing its child processes inside its own path

func PidPath

func PidPath(pid int) Path

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 Slice

func Slice(slice, name string) Path

func StaticPath

func StaticPath(path string) Path

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 PidsStat

type PidsStat struct {
	Current uint64 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"`
	Limit   uint64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
}

func (*PidsStat) Descriptor

func (*PidsStat) Descriptor() ([]byte, []int)

func (*PidsStat) Marshal

func (m *PidsStat) Marshal() (dAtA []byte, err error)

func (*PidsStat) MarshalTo

func (m *PidsStat) MarshalTo(dAtA []byte) (int, error)

func (*PidsStat) ProtoMessage

func (*PidsStat) ProtoMessage()

func (*PidsStat) Reset

func (m *PidsStat) Reset()

func (*PidsStat) Size

func (m *PidsStat) Size() (n int)

func (*PidsStat) String

func (this *PidsStat) String() string

func (*PidsStat) Unmarshal

func (m *PidsStat) Unmarshal(dAtA []byte) error

type Process

type Process struct {
	// Subsystem is the name of the subsystem that the process is in
	Subsystem Name
	// Pid is the process id of the process
	Pid int
	// Path is the full path of the subsystem and location that the process is in
	Path string
}

type State

type State string

State is a type that represents the state of the current cgroup

const (
	Unknown  State = ""
	Thawed   State = "thawed"
	Frozen   State = "frozen"
	Freezing State = "freezing"
	Deleted  State = "deleted"
)

type Subsystem

type Subsystem interface {
	Name() Name
}

func Systemd

func Systemd() ([]Subsystem, error)

func V1

func V1() ([]Subsystem, error)

V1 returns all the groups in the default cgroups mountpoint in a single hierarchy

type SystemdController

type SystemdController struct {
	// contains filtered or unexported fields
}

func NewSystemd

func NewSystemd(root string) (*SystemdController, error)

func (*SystemdController) Create

func (s *SystemdController) Create(path string, resources *specs.LinuxResources) error

func (*SystemdController) Delete

func (s *SystemdController) Delete(path string) error

func (*SystemdController) Name

func (s *SystemdController) Name() Name

type Throttle

type Throttle struct {
	Periods          uint64 `protobuf:"varint,1,opt,name=periods,proto3" json:"periods,omitempty"`
	ThrottledPeriods uint64 `protobuf:"varint,2,opt,name=throttled_periods,json=throttledPeriods,proto3" json:"throttled_periods,omitempty"`
	ThrottledTime    uint64 `protobuf:"varint,3,opt,name=throttled_time,json=throttledTime,proto3" json:"throttled_time,omitempty"`
}

func (*Throttle) Descriptor

func (*Throttle) Descriptor() ([]byte, []int)

func (*Throttle) Marshal

func (m *Throttle) Marshal() (dAtA []byte, err error)

func (*Throttle) MarshalTo

func (m *Throttle) MarshalTo(dAtA []byte) (int, error)

func (*Throttle) ProtoMessage

func (*Throttle) ProtoMessage()

func (*Throttle) Reset

func (m *Throttle) Reset()

func (*Throttle) Size

func (m *Throttle) Size() (n int)

func (*Throttle) String

func (this *Throttle) String() string

func (*Throttle) Unmarshal

func (m *Throttle) Unmarshal(dAtA []byte) error

Jump to

Keyboard shortcuts

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