Commit 0f82c270 authored by Rafael Vieira Falcão's avatar Rafael Vieira Falcão
Browse files

Bug correction in the ResourceProvisionerShared

parent cfe3e806
......@@ -94,7 +94,7 @@ public class InfoAwareSimulation {
*/
private static final int CLOUDLET_CPU_BOUND_ID = 1;
private static final double CLOUDLET_CPU_BOUND_DELAY = 0.0;
private static final int CLOUDLET_CPU_BOUND_LENGTH = 200000000; // CPU-Bound workload (Set a high duration time)
private static final int CLOUDLET_CPU_BOUND_LENGTH = 1000000000; // CPU-Bound workload (Set a high duration time)
private static final int CLOUDLET_CPU_BOUND_PES = 1;
private static final int CLOUDLET_CPU_BOUND_IOPS = 3600; // 2*30*60
......@@ -246,7 +246,7 @@ public class InfoAwareSimulation {
/* Checks if the time specified in the scheduling interval has passed. */
if(time == SCHEDULING_INTERVAL) {
Log.printLine("\n" + info.getTime() + ": # Changing Vm Allocation Policy to: Info-Aware");
Log.printLine("\n" + info.getTime() + ": # Changing Vm Allocation Policy to: Info-Aware");
datacenter = ((DatacenterSimple) datacenter).setVmAllocationPolicy(new VmAllocationPolicyInfoAware());
List<Vm> listVmsLaunched = new ArrayList<>(NUMBER_VMS_LAUNCHED);
......@@ -305,8 +305,8 @@ public class InfoAwareSimulation {
// final PowerModel powerModel = new PowerModelSpecPowerHighPowerMode();
final PowerModel powerModel = new PowerModelSpecPowerLowPowerMode();
ResourceProvisioner ramProvisioner = new ResourceProvisionerShared();
ResourceProvisioner bwProvisioner = new ResourceProvisionerShared();
ResourceProvisioner ramProvisioner = new ResourceProvisionerSimple();
ResourceProvisioner bwProvisioner = new ResourceProvisionerSimple();
ResourceProvisioner iopsProvisioner = new ResourceProvisionerShared();
VmScheduler vmScheduler = new VmSchedulerTimeShared();
Host host = new HostSimple(ram, iops, bw, storage, peList);
......
......@@ -236,7 +236,7 @@ public class ResourceProvisionerShared extends ResourceProvisionerAbstract {
//Allocates the requested resource from the physical resource
getResource().allocateResource(vra.getAllocated());
getResourceAllocationMap().put(vra.getVm(), vra.getAllocated());
vm.getResource(getResourceClass()).setAllocatedResource(vra.getAllocated());
vra.getVm().getResource(getResourceClass()).setAllocatedResource(vra.getAllocated());
}
}
......@@ -259,4 +259,5 @@ public class ResourceProvisionerShared extends ResourceProvisionerAbstract {
return getResource().getAvailableResource() < allocationDifference;
}
}
}
\ No newline at end of file
......@@ -198,17 +198,13 @@ public abstract class CloudletSchedulerAbstract implements CloudletScheduler {
*
* @return the amount of available Iops.
*/
public double getAvailableIops(){
return getIopsCapacity();
private double getAvailableIops(CloudletExecution ce){
return ce.getCloudlet().getVm().getIops().getAllocatedResource();
}
private Double getPeCapacity() {
return currentMipsShare.stream().findFirst().orElse(0.0);
}
private Double getIopsCapacity() {
return iopsCapacity;
}
/**
* Gets the total number of PEs of all cloudlets currently executing in this processor.
......@@ -601,6 +597,8 @@ public abstract class CloudletSchedulerAbstract implements CloudletScheduler {
protected void updateCloudletProcessing(final CloudletExecution ce, final double currentTime) {
final long executedInstructions = cloudletExecutedInstructionsForElapsedTime(ce, currentTime);
final long executedIops = cloudletExecutedIopsForElapsedTime(ce, currentTime);
Log.printLine(executedInstructions);
Log.printLine(executedIops);
ce.updateProcessing(executedInstructions, executedIops);
}
......@@ -716,7 +714,7 @@ public abstract class CloudletSchedulerAbstract implements CloudletScheduler {
final double actualProcessingTime = (hasCloudletFileTransferTimePassed(cl, currentTime) ? timeSpan(cl, currentTime) : 0);
final double cloudletUsedIops =
getAbsoluteCloudletResourceUtilization(cl.getCloudlet().getUtilizationModelIops(),
currentTime, getAvailableIops());
currentTime, getAvailableIops(cl));
return (long) (cloudletUsedIops * actualProcessingTime);
}
......@@ -1021,7 +1019,7 @@ public abstract class CloudletSchedulerAbstract implements CloudletScheduler {
@Override
public double getAllocatedIopsForCloudlet(final CloudletExecution ce, final double time) {
return getAbsoluteCloudletResourceUtilization(ce.getCloudlet().getUtilizationModelIops(), time, getAvailableIops());
return getAbsoluteCloudletResourceUtilization(ce.getCloudlet().getUtilizationModelIops(), time, getAvailableIops(ce));
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment