Documentation ¶
Index ¶
- Variables
- type CpuSubsystem
- type CpusetSubsystem
- func (s *CpusetSubsystem) Apply(cgroupPath string, pid int, res *ResourceConfig) error
- func (s *CpusetSubsystem) CgroupFileName() string
- func (s *CpusetSubsystem) Name() string
- func (s *CpusetSubsystem) Remove(cgroupPath string) error
- func (s *CpusetSubsystem) Set(cgroupPath string, res *ResourceConfig) error
- type MemorySubsystem
- func (s *MemorySubsystem) Apply(cgroupPath string, pid int, res *ResourceConfig) error
- func (s *MemorySubsystem) CgroupFileName() string
- func (s *MemorySubsystem) Name() string
- func (s *MemorySubsystem) Remove(cgroupPath string) error
- func (s *MemorySubsystem) Set(cgroupPath string, res *ResourceConfig) error
- type ResourceConfig
- type Subsystem
Constants ¶
This section is empty.
Variables ¶
View Source
var Ins = []Subsystem{ &MemorySubsystem{}, &CpuSubsystem{}, &CpusetSubsystem{}, }
Functions ¶
This section is empty.
Types ¶
type CpuSubsystem ¶
type CpuSubsystem struct { }
func (*CpuSubsystem) Apply ¶
func (s *CpuSubsystem) Apply(cgroupPath string, pid int, res *ResourceConfig) error
func (*CpuSubsystem) CgroupFileName ¶
func (s *CpuSubsystem) CgroupFileName() string
func (*CpuSubsystem) Name ¶
func (s *CpuSubsystem) Name() string
func (*CpuSubsystem) Remove ¶
func (s *CpuSubsystem) Remove(cgroupPath string) error
func (*CpuSubsystem) Set ¶
func (s *CpuSubsystem) Set(cgroupPath string, res *ResourceConfig) error
type CpusetSubsystem ¶
type CpusetSubsystem struct { }
func (*CpusetSubsystem) Apply ¶
func (s *CpusetSubsystem) Apply(cgroupPath string, pid int, res *ResourceConfig) error
func (*CpusetSubsystem) CgroupFileName ¶
func (s *CpusetSubsystem) CgroupFileName() string
func (*CpusetSubsystem) Name ¶
func (s *CpusetSubsystem) Name() string
func (*CpusetSubsystem) Remove ¶
func (s *CpusetSubsystem) Remove(cgroupPath string) error
func (*CpusetSubsystem) Set ¶
func (s *CpusetSubsystem) Set(cgroupPath string, res *ResourceConfig) error
type MemorySubsystem ¶
type MemorySubsystem struct { }
func (*MemorySubsystem) Apply ¶
func (s *MemorySubsystem) Apply(cgroupPath string, pid int, res *ResourceConfig) error
func (*MemorySubsystem) CgroupFileName ¶
func (s *MemorySubsystem) CgroupFileName() string
func (*MemorySubsystem) Name ¶
func (s *MemorySubsystem) Name() string
func (*MemorySubsystem) Remove ¶
func (s *MemorySubsystem) Remove(cgroupPath string) error
func (*MemorySubsystem) Set ¶
func (s *MemorySubsystem) Set(cgroupPath string, res *ResourceConfig) error
type ResourceConfig ¶
ResourceConfig 用于传递资源限制配置的结构体,包含内存限制,CPU 时间片权重,CPU核心数
type Subsystem ¶
type Subsystem interface { // Name 返回子系统的名称,如cpu、memory Name() string // Set 设置某个cgroup在这个子系统的资源限制 Set(cgroupPath string, res *ResourceConfig) error // Apply 将进程添加到某个cgroup中 Apply(cgroupPath string, pid int, res *ResourceConfig) error // Remove 移除某个cgroup Remove(cgroupPath string) error // CgroupFileName 返回控制子系统资源的cgroup文件名 CgroupFileName() string }
Subsystem 接口,每个Subsystem可以实现下面的4个接口, 这里将cgroup抽象成了path,原因是cgroup在hierarchy的路径,便是虚拟文件系统中的虚拟路径
Click to show internal directories.
Click to hide internal directories.