@Test public void testGetContainerProcessCpuLoad() throws Exception { mockGetContainerProcessCpuLoad(1, 100000.0, 100000.0, 1.0, 1.0); mockGetContainerProcessCpuLoad(1, 100000.0, 100000.0, 0.5, 0.5); mockGetContainerProcessCpuLoad(1, 50000.0, 100000.0, 0.5, 1.0); mockGetContainerProcessCpuLoad(1, 75000.0, 100000.0, 0.5, 0.66); mockGetContainerProcessCpuLoad(2, 100000.0, 100000.0, 0.5, 1.0); mockGetContainerProcessCpuLoad(2, 200000.0, 100000.0, 1.0, 1.0); mockGetContainerProcessCpuLoad(2, 25000.0, 100000.0, 0.125, 1.0); mockGetContainerProcessCpuLoad(2, 2500.0, 100000.0, 0.0125, 1.0); mockGetContainerProcessCpuLoad(2, ContainerMetricUtils.NO_CPU_QUOTA, 100000.0, 0.125, 0.125); }
public static double getContainerProcessCpuLoad(double cpuUtil) throws IOException { int logicalProcessorsOfNode = getAvailableProcessors(); double cpuQuota = getCpuQuota(); if (cpuQuota == NO_CPU_QUOTA) { return cpuUtil; } double cpuLimit = cpuQuota / getCpuPeriod(); double cpus = cpuUtil * logicalProcessorsOfNode; return cpus / cpuLimit; }
ContainerMetricUtils { public static double getContainerProcessCpuLoad(double cpuUtil) throws IOException { int logicalProcessorsOfNode = getAvailableProcessors(); double cpuQuota = getCpuQuota(); if (cpuQuota == NO_CPU_QUOTA) { return cpuUtil; } double cpuLimit = cpuQuota / getCpuPeriod(); double cpus = cpuUtil * logicalProcessorsOfNode; return cpus / cpuLimit; } }
ContainerMetricUtils { public static double getContainerProcessCpuLoad(double cpuUtil) throws IOException { int logicalProcessorsOfNode = getAvailableProcessors(); double cpuQuota = getCpuQuota(); if (cpuQuota == NO_CPU_QUOTA) { return cpuUtil; } double cpuLimit = cpuQuota / getCpuPeriod(); double cpus = cpuUtil * logicalProcessorsOfNode; return cpus / cpuLimit; } private  ContainerMetricUtils(); }
ContainerMetricUtils { public static double getContainerProcessCpuLoad(double cpuUtil) throws IOException { int logicalProcessorsOfNode = getAvailableProcessors(); double cpuQuota = getCpuQuota(); if (cpuQuota == NO_CPU_QUOTA) { return cpuUtil; } double cpuLimit = cpuQuota / getCpuPeriod(); double cpus = cpuUtil * logicalProcessorsOfNode; return cpus / cpuLimit; } private  ContainerMetricUtils(); static double getContainerProcessCpuLoad(double cpuUtil); }
ContainerMetricUtils { public static double getContainerProcessCpuLoad(double cpuUtil) throws IOException { int logicalProcessorsOfNode = getAvailableProcessors(); double cpuQuota = getCpuQuota(); if (cpuQuota == NO_CPU_QUOTA) { return cpuUtil; } double cpuLimit = cpuQuota / getCpuPeriod(); double cpus = cpuUtil * logicalProcessorsOfNode; return cpus / cpuLimit; } private  ContainerMetricUtils(); static double getContainerProcessCpuLoad(double cpuUtil); static final int NO_CPU_QUOTA; }