public static double getContainerProcessCpuLoad(double cpuUtil) throws IOException {
    int logicalProcessorsOfNode = getAvailableProcessors();
    double cpuQuota = getCpuQuota();
    if (cpuQuota == NO_CPU_QUOTA) {
      return cpuUtil;
    }

    // Get the number of CPUs of a node that can be used by the operating environment
    double cpuLimit = cpuQuota / getCpuPeriod();

    // Get the minimal number of CPUs needed to achieve the reported CPU utilization
    double cpus = cpuUtil * logicalProcessorsOfNode;

    /* Calculate the CPU utilization of a JVM process with respect to the operating environment.
     * Since the operating environment will only use the CPU resources allocated by CGroups,
     * it will always be that: cpuLimit >= cpus and the result is in the [0.0,1.0] interval.
     */
    return cpus / cpuLimit;
  }
@Test
  public void testGetContainerProcessCpuLoad() throws Exception {
    /*
     *  expectedContainerProcessCpuLoad = (cpuUtil * processors) / (cpuQuota / cpuPeriod)
     */
    mockGetContainerProcessCpuLoad(1, 100000.0, 1.0, 1.0);
    mockGetContainerProcessCpuLoad(1, 100000.0, 0.5, 0.5);
    mockGetContainerProcessCpuLoad(1, 50000.0, 0.5, 1.0);
    mockGetContainerProcessCpuLoad(1, 75000.0, 0.5, 0.66);

    mockGetContainerProcessCpuLoad(2, 100000.0, 0.5, 1.0);
    mockGetContainerProcessCpuLoad(2, 200000.0, 1.0, 1.0);
    mockGetContainerProcessCpuLoad(2, 25000.0, 0.125, 1.0);
    mockGetContainerProcessCpuLoad(2, 2500.0, 0.0125, 1.0);

    mockGetContainerProcessCpuLoad(2, ContainerMetricUtils.NO_CPU_QUOTA, 0.125, 0.125);
  }