func MilliCPUToQuota(milliCPU int64) (int64, int64) {
	if milliCPU == 0 {
		return 0, 0
	}
	period := int64(kubecm.QuotaPeriod)
	quota := (milliCPU * period) / kubecm.MilliCPUToCPU
	if quota < kubecm.MinQuotaPeriod {
		quota = kubecm.MinQuotaPeriod
	}
	return quota, period
}
MilliCPUToQuota converts milliCPU to CFS quota and period values.
package cache
import (
	"io/ioutil"
	"os"
	"path"
	"strconv"
	"strings"
	corev1 "k8s.io/api/core/v1"
	resapi "k8s.io/apimachinery/pkg/api/resource"
	"k8s.io/apimachinery/pkg/util/sets"
	cri "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
	kubecm "k8s.io/kubernetes/pkg/kubelet/cm"
	"github.com/intel/cri-resource-manager/pkg/cgroups"
)
var memoryCapacity int64
func IsPodQOSClassName(class string) bool {
	switch corev1.PodQOSClass(class) {
	case corev1.PodQOSBestEffort, corev1.PodQOSBurstable, corev1.PodQOSGuaranteed:
		return true
	}
	return false
}
func estimateComputeResources(lnx *cri.LinuxContainerResources, cgroupParent string) corev1.ResourceRequirements {
	var qos corev1.PodQOSClass
	resources := corev1.ResourceRequirements{
		Requests: corev1.ResourceList{},
		Limits:   corev1.ResourceList{},
	}
	if lnx == nil {
		return resources
	}
	if cgroupParent != "" {
		qos = cgroupParentToQOS(cgroupParent)
	}
	if value := SharesToMilliCPU(lnx.CpuShares); value > 0 {
		qty := resapi.NewMilliQuantity(value, resapi.DecimalSI)
		resources.Requests[corev1.ResourceCPU] = *qty
	}
	if value := lnx.MemoryLimitInBytes; value > 0 {
		qty := resapi.NewQuantity(value, resapi.DecimalSI)
		resources.Limits[corev1.ResourceMemory] = *qty
	}
	if qos == corev1.PodQOSGuaranteed {
		resources.Limits[corev1.ResourceCPU] = resources.Requests[corev1.ResourceCPU]
		resources.Requests[corev1.ResourceMemory] = resources.Limits[corev1.ResourceMemory]
	} else {
		if value := QuotaToMilliCPU(lnx.CpuQuota, lnx.CpuPeriod); value > 0 {
			qty := resapi.NewMilliQuantity(value, resapi.DecimalSI)
			resources.Limits[corev1.ResourceCPU] = *qty
		}
	}
	return resources
}
func SharesToMilliCPU(shares int64) int64 {
	return sharesToMilliCPU(shares)
}
func QuotaToMilliCPU(quota, period int64) int64 {
	return quotaToMilliCPU(quota, period)
}
func sharesToMilliCPU(shares int64) int64 {
	if shares == kubecm.MinShares {
		return 0
	}
	return int64(float64(shares*kubecm.MilliCPUToCPU)/float64(kubecm.SharesPerCPU) + 0.5)
}
func quotaToMilliCPU(quota, period int64) int64 {
	if quota == 0 || period == 0 {
		return 0
	}
	return int64(float64(quota*kubecm.MilliCPUToCPU)/float64(period) + 0.5)
}
func MilliCPUToShares(milliCPU int) int64 {
	return int64(kubecm.MilliCPUToShares(int64(milliCPU)))
}