/** * Receives a Vm {@link UtilizationHistory} and returns a {@link Function} that * requires a map entry from the history (representing a VM's CPU utilization for a given time), * and returns the percentage of the Host CPU capacity that Vm is using at that time. * This way, the value that represents how much of the VM's CPU is being used * will be converted to how much that VM is using from the Host's CPU. * * @param utilizationHistory the VM {@link UtilizationHistory} with the history entries * @return */ private Function<Entry<Double, Double>, Double> vmUtilizationMapper(final UtilizationHistory utilizationHistory) { final double totalMipsCapacity = getTotalMipsCapacity(); return entry -> entry.getValue() * utilizationHistory.getVm().getTotalMipsCapacity() / totalMipsCapacity; }