Documentation ¶
Index ¶
- Constants
- Variables
- func Average(arr []float64) float64
- func CgroupCleanAll()
- func CgroupDestroy(pid, name string) bool
- func CgroupIoHardlimitSet(pid, name string, coreNum int, params map[string]int, devId string) bool
- func CgroupIsMounted() bool
- func CgroupSet(pid, name string, coreNum int) bool
- func CleanupNonexistPids(module string)
- func CommitProcessCpuset(proc *ProcessCPUinfo, idx int)
- func CommitProcessesCpuset(cpus []CPULoad)
- func FetchHistoryUtil() map[string][]float64
- func GetAllPids() ([]string, error)
- func GetMaxLoadDiff(cpus []CPULoad) float64
- func GetProcessWeight(share *float64, util float64) float64
- func GetRootParam(module, name, pid string) string
- func GetTaskParamPath(module, name, pid string) string
- func Init(ioScheduler string) bool
- func ModuleIsMounted(module string) bool
- func ParseCpusetStr(cpuset string) string
- func RebalanceProcesses(pids []string)
- func RootTaskPath(module string) string
- func SaveHistoryUtil()
- func SetRootParam(module, name, value, pid string) bool
- type CGroupCPUSetTask
- type CGroupCPUTask
- type CGroupIOHardlimitTask
- type CGroupIOTask
- type CGroupMemoryTask
- type CGroupTask
- func (c *CGroupTask) Configure() bool
- func (c *CGroupTask) GetConfig() map[string]string
- func (c *CGroupTask) GetParam(name string) string
- func (c *CGroupTask) GetStaticConfig() map[string]string
- func (c *CGroupTask) GetTaskIds() []string
- func (c *CGroupTask) GetWeight() float64
- func (c *CGroupTask) GroupName() string
- func (c *CGroupTask) InitTask(hand ICGroupTask, coreNum int, pid, name string)
- func (c *CGroupTask) Module() string
- func (c *CGroupTask) MoveTasksToRoot()
- func (c *CGroupTask) PushPid(pid string, isRoot bool)
- func (c *CGroupTask) RemoveTask() bool
- func (c *CGroupTask) SetHand(hand ICGroupTask)
- func (c *CGroupTask) SetName(name string)
- func (c *CGroupTask) SetParam(name, value string) bool
- func (c *CGroupTask) SetParams(conf map[string]string) bool
- func (c *CGroupTask) SetPid(pid string)
- func (c *CGroupTask) SetTask() bool
- func (c *CGroupTask) SetWeight(coreNum int)
- func (c *CGroupTask) TaskPath() string
- type CPU
- type CPUCore
- type CPUDie
- type CPULoad
- type ICGroupTask
- type ProcessCPUinfo
Constants ¶
View Source
const ( CGROUP_PATH_SYSFS = "/sys/fs/cgroup" CGROUP_PATH_ROOT = "/cgroup" CGROUP_TASKS = "tasks" )
View Source
const ( CPU_SHARES = "cpu.shares" )
View Source
const ( IoWeightBase = 100 IoWeightMax = 1000 IoWeightMin = 100 BLOCK_IO_WEIGHT = "blkio.weight" BLOCK_IO_BFQ_WEIGHT = "blkio.bfq.weight" IOSCHED_CFQ = "cfq" IOSCHED_BFQ = "bfq" )
View Source
const ( CPUSET_CPUS = "cpuset.cpus" CPUSET_MEMS = "cpuset.mems" CPUSET_SCHED_LOAD_BALANCE = "cpuset.sched_load_balance" )
View Source
const (
MAX_HISTORY_UTIL_COUNT = 5
)
View Source
const (
MEMORY_SWAPPINESS = "memory.swappiness"
)
Variables ¶
View Source
var ( /* * A global IoScheduler variable, should be set before initialize CGROUP */ IoScheduler string )
Functions ¶
func CgroupCleanAll ¶
func CgroupCleanAll()
func CgroupDestroy ¶
func CgroupIoHardlimitSet ¶
func CgroupIsMounted ¶
func CgroupIsMounted() bool
func CommitProcessCpuset ¶
func CommitProcessCpuset(proc *ProcessCPUinfo, idx int)
func CommitProcessesCpuset ¶
func CommitProcessesCpuset(cpus []CPULoad)
func FetchHistoryUtil ¶
func GetAllPids ¶
func GetMaxLoadDiff ¶
func GetProcessWeight ¶
func GetRootParam ¶
func GetTaskParamPath ¶
func ModuleIsMounted ¶
func ParseCpusetStr ¶
func RebalanceProcesses ¶
func RebalanceProcesses(pids []string)
func RootTaskPath ¶
func SaveHistoryUtil ¶
func SaveHistoryUtil()
func SetRootParam ¶
Types ¶
type CGroupCPUSetTask ¶
type CGroupCPUSetTask struct { *CGroupTask // contains filtered or unexported fields }
func NewCGroupCPUSetTask ¶
func NewCGroupCPUSetTask(pid, name string, coreNum int, cpuset string) CGroupCPUSetTask
func (*CGroupCPUSetTask) CustomConfig ¶
func (c *CGroupCPUSetTask) CustomConfig(key, value string) bool
func (*CGroupCPUSetTask) GetConfig ¶
func (c *CGroupCPUSetTask) GetConfig() map[string]string
func (*CGroupCPUSetTask) GetStaticConfig ¶
func (c *CGroupCPUSetTask) GetStaticConfig() map[string]string
func (*CGroupCPUSetTask) Module ¶
func (c *CGroupCPUSetTask) Module() string
type CGroupCPUTask ¶
type CGroupCPUTask struct {
*CGroupTask
}
func NewCGroupCPUTask ¶
func NewCGroupCPUTask(pid, name string, coreNum int) CGroupCPUTask
func (*CGroupCPUTask) GetConfig ¶
func (c *CGroupCPUTask) GetConfig() map[string]string
func (*CGroupCPUTask) Module ¶
func (c *CGroupCPUTask) Module() string
type CGroupIOHardlimitTask ¶
type CGroupIOHardlimitTask struct { *CGroupIOTask // contains filtered or unexported fields }
func (*CGroupIOHardlimitTask) GetConfig ¶
func (c *CGroupIOHardlimitTask) GetConfig() map[string]string
type CGroupIOTask ¶
type CGroupIOTask struct {
*CGroupTask
}
func NewCGroupIOTask ¶
func NewCGroupIOTask(pid, name string, coreNum int) *CGroupIOTask
func (*CGroupIOTask) GetConfig ¶
func (c *CGroupIOTask) GetConfig() map[string]string
func (*CGroupIOTask) Module ¶
func (c *CGroupIOTask) Module() string
type CGroupMemoryTask ¶
type CGroupMemoryTask struct {
*CGroupTask
}
func NewCGroupMemoryTask ¶
func NewCGroupMemoryTask(pid, name string, coreNum int) *CGroupMemoryTask
func (*CGroupMemoryTask) GetConfig ¶
func (c *CGroupMemoryTask) GetConfig() map[string]string
func (*CGroupMemoryTask) Module ¶
func (c *CGroupMemoryTask) Module() string
type CGroupTask ¶
type CGroupTask struct {
// contains filtered or unexported fields
}
func NewCGroupTask ¶
func NewCGroupTask(pid, name string, coreNum int) *CGroupTask
func (*CGroupTask) Configure ¶
func (c *CGroupTask) Configure() bool
func (*CGroupTask) GetConfig ¶
func (c *CGroupTask) GetConfig() map[string]string
func (*CGroupTask) GetParam ¶
func (c *CGroupTask) GetParam(name string) string
func (*CGroupTask) GetStaticConfig ¶
func (c *CGroupTask) GetStaticConfig() map[string]string
func (*CGroupTask) GetTaskIds ¶
func (c *CGroupTask) GetTaskIds() []string
func (*CGroupTask) GetWeight ¶
func (c *CGroupTask) GetWeight() float64
func (*CGroupTask) GroupName ¶
func (c *CGroupTask) GroupName() string
func (*CGroupTask) InitTask ¶
func (c *CGroupTask) InitTask(hand ICGroupTask, coreNum int, pid, name string)
func (*CGroupTask) Module ¶
func (c *CGroupTask) Module() string
func (*CGroupTask) MoveTasksToRoot ¶
func (c *CGroupTask) MoveTasksToRoot()
func (*CGroupTask) PushPid ¶
func (c *CGroupTask) PushPid(pid string, isRoot bool)
func (*CGroupTask) RemoveTask ¶
func (c *CGroupTask) RemoveTask() bool
func (*CGroupTask) SetHand ¶
func (c *CGroupTask) SetHand(hand ICGroupTask)
func (*CGroupTask) SetName ¶
func (c *CGroupTask) SetName(name string)
func (*CGroupTask) SetParam ¶
func (c *CGroupTask) SetParam(name, value string) bool
func (*CGroupTask) SetPid ¶
func (c *CGroupTask) SetPid(pid string)
func (*CGroupTask) SetTask ¶
func (c *CGroupTask) SetTask() bool
func (*CGroupTask) SetWeight ¶
func (c *CGroupTask) SetWeight(coreNum int)
func (*CGroupTask) TaskPath ¶
func (c *CGroupTask) TaskPath() string
type CPU ¶
type CPU struct {
DieList []*CPUDie
}
func GetSystemCpu ¶
func (*CPU) GetPhysicalId ¶
func (*CPU) GetPhysicalNum ¶
type CPUCore ¶
type CPUCore struct { Index int VendorId string Mhz float64 CacheSize string PhysicalId int CoreId int }
func NewCPUCore ¶
type CPUDie ¶
func (*CPUDie) GetCoreStr ¶
type CPULoad ¶
type CPULoad struct {
Processes []*ProcessCPUinfo
}
func ArrangeProcesses ¶
func ArrangeProcesses(infos []*ProcessCPUinfo, cpuCount int) []CPULoad
func GetMinLoadCpu ¶
func (*CPULoad) AddProcess ¶
func (c *CPULoad) AddProcess(proc *ProcessCPUinfo)
type ICGroupTask ¶
type ICGroupTask interface { InitTask(hand ICGroupTask, coreNum int, pid, name string) SetPid(string) SetName(string) SetWeight(coreNum int) SetHand(hand ICGroupTask) GetStaticConfig() map[string]string GetConfig() map[string]string Module() string RemoveTask() bool SetTask() bool Configure() bool // contains filtered or unexported methods }
type ProcessCPUinfo ¶
func GetProcessesCpuinfo ¶
func GetProcessesCpuinfo(pids []string) ([]*ProcessCPUinfo, error)
func NewProcessCPUinfo ¶
func NewProcessCPUinfo(pid int) (*ProcessCPUinfo, error)
func (*ProcessCPUinfo) String ¶
func (p *ProcessCPUinfo) String() string
Click to show internal directories.
Click to hide internal directories.