add cpu.cfs_period_us support
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
This commit is contained in:
parent
eef8989683
commit
cec0cd69cb
1 changed files with 10 additions and 2 deletions
|
@ -15,6 +15,7 @@ import (
|
||||||
type SysInfo struct {
|
type SysInfo struct {
|
||||||
MemoryLimit bool
|
MemoryLimit bool
|
||||||
SwapLimit bool
|
SwapLimit bool
|
||||||
|
CpuCfsPeriod bool
|
||||||
CpuCfsQuota bool
|
CpuCfsQuota bool
|
||||||
IPv4ForwardingDisabled bool
|
IPv4ForwardingDisabled bool
|
||||||
AppArmor bool
|
AppArmor bool
|
||||||
|
@ -50,8 +51,15 @@ func New(quiet bool) *SysInfo {
|
||||||
logrus.Warnf("%v", err)
|
logrus.Warnf("%v", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_, err1 := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_quota_us"))
|
_, err := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_period_us"))
|
||||||
sysInfo.CpuCfsQuota = err1 == nil
|
logrus.Warnf("%s", cgroupCpuMountpoint)
|
||||||
|
sysInfo.CpuCfsPeriod = err == nil
|
||||||
|
if !sysInfo.CpuCfsPeriod && !quiet {
|
||||||
|
logrus.Warnf("WARING: Your kernel does not support cgroup cfs period")
|
||||||
|
}
|
||||||
|
_, err = ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_quota_us"))
|
||||||
|
logrus.Warnf("%s", cgroupCpuMountpoint)
|
||||||
|
sysInfo.CpuCfsQuota = err == nil
|
||||||
if !sysInfo.CpuCfsQuota && !quiet {
|
if !sysInfo.CpuCfsQuota && !quiet {
|
||||||
logrus.Warn("Your kernel does not support cgroup cfs quotas")
|
logrus.Warn("Your kernel does not support cgroup cfs quotas")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue