public static Fraction getAverageCpuCoresPerPrimary( ProcessingUnit pu, CapacityRequirementsPerAgent aggregatedAllocatedCapacity) { CapacityRequirements totalAllocatedCapacity = aggregatedAllocatedCapacity.getTotalAllocatedCapacity(); if (totalAllocatedCapacity.equalsZero()) { throw new IllegalStateException("allocated capacity cannot be empty."); } return getCpuCores(totalAllocatedCapacity).divide(pu.getNumberOfInstances()); }
private static Fraction getCpuCores(CapacityRequirements totalAllocatedCapacity) { return totalAllocatedCapacity.getRequirement(new CpuCapacityRequirement().getType()).getCpu(); }