I'm trying to find host utilization value and get specific value but I'm still confused because the host utilization value I can get is a fixed value which means I failed to get it as I found
1- host utilization equal to sum(vm utilization)
2- Vm utilization equal to AbsoluteCloudletCpuUtilizationForAllPes(time, cloudlet)).sum() / vm.getTotalMipsCapacity();
3- AbsoluteCloudletCpuUtilizationForAllPes(time, cloudlet)
private double getAbsoluteCloudletCpuUtilizationForAllPes(final double time, final Cloudlet cloudlet) {
final double cloudletCpuUsageForOnePe =
getAbsoluteCloudletResourceUtilization(
cloudlet.getUtilizationModelCpu(), time, getAvailableMipsByPe());
return cloudletCpuUsageForOnePe * cloudlet.getNumberOfPes();
}
*/
private double getAbsoluteCloudletResourceUtilization(
final UtilizationModel model,
final double time,
final double maxResourceAllowedToUse)
{
if (model.getUnit() == Unit.ABSOLUTE) {
return Math.min(model.getUtilization(time), maxResourceAllowedToUse);
}
return model.getUtilization() * maxResourceAllowedToUse;
}
4- model.getUtilization()
private static final double CLOUDLET_INITIAL_CPU_PERCENTAGE = 0.8;
createCpuUtilizationModel(CLOUDLET_INITIAL_CPU_PERCENTAGE, 1);
private UtilizationModelDynamic createCpuUtilizationModel(double initialCpuUsagePercent, double maxCpuUsagePercentage) {
if(maxCpuUsagePercentage < initialCpuUsagePercent){
throw new IllegalArgumentException("Max CPU usage must be equal or greater than the initial CPU usage.");
}
initialCpuUsagePercent = Math.min(initialCpuUsagePercent, 1);
maxCpuUsagePercentage = Math.min(maxCpuUsagePercentage, 1);
UtilizationModelDynamic um;
if (initialCpuUsagePercent < maxCpuUsagePercentage) {
um = new UtilizationModelDynamic(initialCpuUsagePercent)
.setUtilizationUpdateFunction(this::getCpuUsageIncrement);
} else {
um = new UtilizationModelDynamic(initialCpuUsagePercent);
}
um.setMaxResourceUtilization(maxCpuUsagePercentage);
5- return um;
6- }
public UtilizationModelDynamic(final Unit unit, final double initialUtilization, final double maxResourceUtilization) {
super(unit);
this.readOnly = false;
this.setMaxResourceUtilization(maxResourceUtilization);
this.previousUtilizationTime = 0;
this.currentUtilizationTime = 0;
this.setCurrentUtilization(initialUtilization);
utilizationUpdateFunction = modelInstance -> modelInstance.currentUtilization;
}
public double getUtilization(final double time) {
currentUtilizationTime = time;
if(previousUtilizationTime != time) {
currentUtilization = utilizationUpdateFunction.apply(new UtilizationModelDynamic(this));
previousUtilizationTime = time;
if (currentUtilization maxResourceUtilization && maxResourceUtilization > 0) {
currentUtilization = maxResourceUtilization;
}
}
return currentUtilization;
}
Can't I understand the currentUtilization equal to the constant value as the initial use?