Documentation
¶
Index ¶
- Constants
- func CalculateOomAdjToMemReqEstimates() map[int64]int64
- func GetMemoryCapacity() int64
- func MemReqToOomAdj(memRequest int64) int64
- func MilliCPUToQuota(milliCPU int64) (quota, period int64)
- func MilliCPUToShares(milliCPU int64) uint64
- func OomAdjToMemReq(oomAdj int64, memLimit int64) *int64
- func QuotaToMilliCPU(quota, period int64) int64
- func ResmgrKey(name string) string
- func SetMemoryCapacity(capacity int64)
- func SharesToMilliCPU(shares int64) int64
- func ShortCPUSet(cset cpuset.CPUSet) string
Constants ¶
const ( // ResmgrKeyNamespace is a NRI Resource Policy namespace ResmgrKeyNamespace = "resource-policy.nri.io" // NamespaceSystem is the kubernetes system namespace. NamespaceSystem = "kube-system" // PodNameLabel is the key for the kubernetes pod name label. PodNameLabel = "io.kubernetes.pod.name" // ContainerNameLabel is the key for the kubernetes container name label. ContainerNameLabel = "io.kubernetes.container.name" )
const ( MinShares = 2 MaxShares = 262144 SharesPerCPU = 1024 // MilliCPUToCPU is milli-CPUs worth a full CPU. MilliCPUToCPU = 1000 // QuotaPeriod is 100000 microseconds, or 100ms QuotaPeriod = 100000 // MinQuotaPeriod is 1000 microseconds, or 1ms MinQuotaPeriod = 1000 GuaranteedOOMScoreAdj = -997 BestEffortOOMScoreAdj = 1000 MinBurstableOOMScoreAdj = 1000 + GuaranteedOOMScoreAdj // 1000 - 997 = 3 MaxBurstableOOMScoreAdj = BestEffortOOMScoreAdj - 1 // 1000 - 1 = 999 )
Variables ¶
This section is empty.
Functions ¶
func CalculateOomAdjToMemReqEstimates ¶ added in v0.9.0
CalculateOomAdjToMemReqEstimates calculates a table of memory request estimates for OOM score adjustments in the range [0, 1000].
func GetMemoryCapacity ¶ added in v0.9.0
func GetMemoryCapacity() int64
func MemReqToOomAdj ¶ added in v0.9.0
MemReqToOomAdj estimates OOM score adjustment based on memory request.
func MilliCPUToQuota ¶
MilliCPUToQuota converts milliCPU to CFS quota and period values. (Almost) identical to the same function in kubelet.
func MilliCPUToShares ¶
MilliCPUToShares converts the milliCPU to CFS shares. Identical to the same function in kubelet.
func OomAdjToMemReq ¶ added in v0.9.0
OomAdjToMemReq estimates memory request based on OOM score adjustment.
func QuotaToMilliCPU ¶
QuotaToMilliCPU converts CFS quota and period to milli-CPUs.
func SetMemoryCapacity ¶ added in v0.9.0
func SetMemoryCapacity(capacity int64)
Set memory capacity for OOM adjustment to memory request estimation. Exported to allow testing the estimator code with different memory capacities.
func SharesToMilliCPU ¶
SharesToMilliCPU converts CFS CPU shares to milli-CPUs.
func ShortCPUSet ¶
ShortCPUSet prints the cpuset as a string, trying to further shorten compared to .String().
Types ¶
This section is empty.