Commit 7d4408e9 authored by rodrigo.calheiros's avatar rodrigo.calheiros

Datacenter: Fixed problem with very short intervals between events.

parent e4068c6d
...@@ -910,7 +910,7 @@ public class Datacenter extends SimEntity { ...@@ -910,7 +910,7 @@ public class Datacenter extends SimEntity {
protected void updateCloudletProcessing() { protected void updateCloudletProcessing() {
//Log.printLine(CloudSim.clock()+": PowerDatacenter #"+this.get_id()+": updating cloudlet processing......................................."); //Log.printLine(CloudSim.clock()+": PowerDatacenter #"+this.get_id()+": updating cloudlet processing.......................................");
//if some time passed since last processing //if some time passed since last processing
if (CloudSim.clock() > this.getLastProcessTime()) { if (CloudSim.clock() > this.getLastProcessTime()+0.1) {
List<? extends Host> list = getVmAllocationPolicy().getHostList(); List<? extends Host> list = getVmAllocationPolicy().getHostList();
double smallerTime = Double.MAX_VALUE; double smallerTime = Double.MAX_VALUE;
//for each host... //for each host...
...@@ -922,9 +922,10 @@ public class Datacenter extends SimEntity { ...@@ -922,9 +922,10 @@ public class Datacenter extends SimEntity {
smallerTime = time; smallerTime = time;
} }
} }
//schedules an event to the next time, if valid //gurantees a minimal interval before scheduling the event
//if (smallerTime > CloudSim.clock() + 0.01 && smallerTime != Double.MAX_VALUE && smallerTime < getSchedulingInterval()) { if (smallerTime<CloudSim.clock()+0.1) smallerTime=CloudSim.clock()+0.1;
if (smallerTime > CloudSim.clock() + 0.01 && smallerTime != Double.MAX_VALUE) {
if (smallerTime != Double.MAX_VALUE) {
schedule(getId(), (smallerTime - CloudSim.clock()), CloudSimTags.VM_DATACENTER_EVENT); schedule(getId(), (smallerTime - CloudSim.clock()), CloudSimTags.VM_DATACENTER_EVENT);
} }
setLastProcessTime(CloudSim.clock()); setLastProcessTime(CloudSim.clock());
......
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