Documentation ¶
Index ¶
- Variables
- func DestroyCgroup(path string) error
- func GetCgroupPathByPid(pid int, subsystem string) (string, error)
- func GetEnabledSubsystems() (map[string]int, error)
- func GetProcessCgroups(pid int) (map[string]string, error)
- func GetSubsystemMountpoint(subsystem string) (string, error)
- func IsCgroupInitError(err error) bool
- func IsCgroupsNotFoundError(err error) bool
- func IsUnsupportedError(err error) bool
- func NewCgroupInitError(subsystem string, err error) error
- func NewCgroupsNotFoundError(pid int) error
- func NewUnsupportedError(subsystem string) error
- func TestCgroup(t *testing.T)
- type Cgroup
- type CgroupInitError
- type CgroupsNotFoundError
- type Config
- type CpuGroup
- type CpuStats
- type CpuUsage
- type Manager
- type MemoryGroup
- type Stats
- type ThrottlingData
- type UnsupportedError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCfsNotEnabled = errors.New("Make sure that CONFIG_CFS_BANDWIDTH option is enabled in your kernel") ErrRtNotEnabled = errors.New("Make sure that CONFIG_RT_GROUP_SCHED option is enabled in your kernel") )
View Source
var (
ErrCgroupRemoved = errors.New("Unable to continue. Control group already removed")
)
Functions ¶
func DestroyCgroup ¶
func GetEnabledSubsystems ¶
func GetSubsystemMountpoint ¶
func IsCgroupInitError ¶
func IsCgroupsNotFoundError ¶
func IsUnsupportedError ¶
func NewCgroupInitError ¶
func NewCgroupsNotFoundError ¶
func NewUnsupportedError ¶
func TestCgroup ¶
Types ¶
type CgroupInitError ¶
func (*CgroupInitError) Error ¶
func (e *CgroupInitError) Error() string
type CgroupsNotFoundError ¶
type CgroupsNotFoundError struct {
// contains filtered or unexported fields
}
func (*CgroupsNotFoundError) Error ¶
func (e *CgroupsNotFoundError) Error() string
type Config ¶
type Config struct { int64 `json:"cpu_shares"` // 以下两个参数用于限制CPU最高使用率 CpuQuota int64 `json:"cpu_quota"` CpuPeriod int64 `json:"cpu_period"` // 以下两个参数用于设置CPU最高使用率 CpuRtRuntime int64 `json:"cpu_rt_runtime"` CpuRtPeriod int64 `json:"cpu_rt_period"` //限制最大内存使用量 MemoryLimit int64 `json:"memory_quota"` }CpuShares
type CpuStats ¶
type CpuStats struct { CpuUsage CpuUsage `json:"cpu_usage,omitempty"` ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` }
type CpuUsage ¶
type CpuUsage struct { // Total CPU time consumed (in nanoseconds). TotalUsage uint64 `json:"total_usage,omitempty"` // Total CPU time consumed per core (in nanoseconds). PercpuUsage []uint64 `json:"percpu_usage,omitempty"` // Time spent by tasks of the cgroup in kernel mode (in nanoseconds). UsageInKernelmode uint64 `json:"usage_in_kernelmode"` // Time spent by tasks of the cgroup in user mode (in nanoseconds). UsageInUsermode uint64 `json:"usage_in_usermode"` }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
The wrapper around the several control groups to more convenient using.
func LoadManager ¶
type MemoryGroup ¶
type MemoryGroup struct {
// contains filtered or unexported fields
}
func (*MemoryGroup) Get ¶
func (g *MemoryGroup) Get(c *Config) error
func (*MemoryGroup) GetPath ¶
func (g *MemoryGroup) GetPath() string
func (*MemoryGroup) Set ¶
func (g *MemoryGroup) Set(c *Config) error
type ThrottlingData ¶
type ThrottlingData struct { // Number of periods with throttling active. Periods uint64 `json:"nr_periods,omitempty"` // Number of times when the tasks have been throttled. ThrottledPeriods uint64 `json:"nr_throttled,omitempty"` // Aggregate time when the tasks have been throttled (in nanoseconds). ThrottledTime uint64 `json:"throttled_time,omitempty"` }
type UnsupportedError ¶
type UnsupportedError struct {
Subsystem string
}
func (*UnsupportedError) Error ¶
func (e *UnsupportedError) Error() string
Click to show internal directories.
Click to hide internal directories.