Commit ef051eb2 authored by rodrigo.calheiros's avatar rodrigo.calheiros

Fixed issue affecting all CloudletSchedulers: if updated was less then 1, due to a small timespam,

processing was never updated, because it was always rounded to 0.
parent 7d4408e9
...@@ -76,9 +76,9 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare ...@@ -76,9 +76,9 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
List<ResCloudlet> cloudletsToFinish = new ArrayList<ResCloudlet>(); List<ResCloudlet> cloudletsToFinish = new ArrayList<ResCloudlet>();
for (ResCloudlet rcl : getCloudletExecList()) { for (ResCloudlet rcl : getCloudletExecList()) {
rcl.updateCloudletFinishedSoFar((long) (timeSpan * getTotalCurrentAllocatedMipsForCloudlet(rcl, getPreviousTime()))); rcl.updateCloudletFinishedSoFar((long) Math.ceil((timeSpan * getTotalCurrentAllocatedMipsForCloudlet(rcl, getPreviousTime()))));
if (rcl.getRemainingCloudletLength() == 0.0) { //finished: remove from the list if (rcl.getRemainingCloudletLength() == 0) { //finished: remove from the list
cloudletsToFinish.add(rcl); cloudletsToFinish.add(rcl);
continue; continue;
} else { //not finish: estimate the finish time } else { //not finish: estimate the finish time
......
...@@ -91,7 +91,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler { ...@@ -91,7 +91,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
capacity /= cpus; // average capacity of each cpu capacity /= cpus; // average capacity of each cpu
for (ResCloudlet rcl : getCloudletExecList()) { // each machine in the exec list has the same amount of cpu for (ResCloudlet rcl : getCloudletExecList()) { // each machine in the exec list has the same amount of cpu
rcl.updateCloudletFinishedSoFar((long) (capacity * timeSpam * rcl.getPesNumber())); rcl.updateCloudletFinishedSoFar((long) Math.ceil((capacity * timeSpam * rcl.getPesNumber())));
} }
if (getCloudletExecList().size() == 0 && getCloudletWaitingList().size() == 0) { // no more cloudlets in this scheduler if (getCloudletExecList().size() == 0 && getCloudletWaitingList().size() == 0) { // no more cloudlets in this scheduler
...@@ -104,7 +104,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler { ...@@ -104,7 +104,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
int cont = 0; int cont = 0;
List<ResCloudlet> toRemove = new ArrayList<ResCloudlet>(); List<ResCloudlet> toRemove = new ArrayList<ResCloudlet>();
for (ResCloudlet rcl : getCloudletExecList()) { for (ResCloudlet rcl : getCloudletExecList()) {
if (rcl.getRemainingCloudletLength() == 0.0) {// finished anyway, rounding issue... if (rcl.getRemainingCloudletLength() == 0) {// finished anyway, rounding issue...
toRemove.add(rcl); toRemove.add(rcl);
cloudletFinish(rcl); cloudletFinish(rcl);
finished++; finished++;
...@@ -173,7 +173,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler { ...@@ -173,7 +173,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
for (ResCloudlet rcl : getCloudletExecList()) { for (ResCloudlet rcl : getCloudletExecList()) {
if (rcl.getCloudletId() == cloudletId) { if (rcl.getCloudletId() == cloudletId) {
getCloudletExecList().remove(rcl); getCloudletExecList().remove(rcl);
if (rcl.getRemainingCloudletLength() == 0.0) { if (rcl.getRemainingCloudletLength() == 0) {
cloudletFinish(rcl); cloudletFinish(rcl);
} else { } else {
rcl.setCloudletStatus(Cloudlet.CANCELED); rcl.setCloudletStatus(Cloudlet.CANCELED);
...@@ -230,7 +230,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler { ...@@ -230,7 +230,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
if (found){ if (found){
//moves to the paused list //moves to the paused list
ResCloudlet rgl = getCloudletExecList().remove(position); ResCloudlet rgl = getCloudletExecList().remove(position);
if (rgl.getRemainingCloudletLength() == 0.0) { if (rgl.getRemainingCloudletLength() == 0) {
cloudletFinish(rgl); cloudletFinish(rgl);
} else { } else {
rgl.setCloudletStatus(Cloudlet.PAUSED); rgl.setCloudletStatus(Cloudlet.PAUSED);
...@@ -254,7 +254,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler { ...@@ -254,7 +254,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
if (found) { if (found) {
// moves to the paused list // moves to the paused list
ResCloudlet rgl = getCloudletWaitingList().remove(position); ResCloudlet rgl = getCloudletWaitingList().remove(position);
if (rgl.getRemainingCloudletLength() == 0.0) { if (rgl.getRemainingCloudletLength() == 0) {
cloudletFinish(rgl); cloudletFinish(rgl);
} else { } else {
rgl.setCloudletStatus(Cloudlet.PAUSED); rgl.setCloudletStatus(Cloudlet.PAUSED);
......
...@@ -69,7 +69,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler { ...@@ -69,7 +69,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
double timeSpam = currentTime - getPreviousTime(); double timeSpam = currentTime - getPreviousTime();
for (ResCloudlet rcl : getCloudletExecList()) { for (ResCloudlet rcl : getCloudletExecList()) {
rcl.updateCloudletFinishedSoFar((long) (getCapacity(mipsShare) * timeSpam * rcl.getPesNumber())); rcl.updateCloudletFinishedSoFar((long) Math.ceil((getCapacity(mipsShare) * timeSpam * rcl.getPesNumber())));
} }
if (getCloudletExecList().size() == 0) { if (getCloudletExecList().size() == 0) {
...@@ -82,8 +82,8 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler { ...@@ -82,8 +82,8 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
int i = 0; int i = 0;
List<ResCloudlet> toRemove = new ArrayList<ResCloudlet>(); List<ResCloudlet> toRemove = new ArrayList<ResCloudlet>();
for (ResCloudlet rcl : getCloudletExecList()) { for (ResCloudlet rcl : getCloudletExecList()) {
double remainingLength = rcl.getRemainingCloudletLength(); long remainingLength = rcl.getRemainingCloudletLength();
if (remainingLength == 0.00) {// finished: remove from the list if (remainingLength == 0) {// finished: remove from the list
toRemove.add(rcl); toRemove.add(rcl);
cloudletFinish(rcl); cloudletFinish(rcl);
continue; continue;
...@@ -181,7 +181,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler { ...@@ -181,7 +181,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
if (found) { if (found) {
ResCloudlet rcl = getCloudletExecList().remove(position); ResCloudlet rcl = getCloudletExecList().remove(position);
if (rcl.getRemainingCloudletLength() == 0.0) { if (rcl.getRemainingCloudletLength() == 0) {
cloudletFinish(rcl); cloudletFinish(rcl);
} else { } else {
rcl.setCloudletStatus(Cloudlet.CANCELED); rcl.setCloudletStatus(Cloudlet.CANCELED);
...@@ -234,7 +234,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler { ...@@ -234,7 +234,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
if (found) { if (found) {
// remove cloudlet from the exec list and put it in the paused list // remove cloudlet from the exec list and put it in the paused list
ResCloudlet rcl = getCloudletExecList().remove(position); ResCloudlet rcl = getCloudletExecList().remove(position);
if (rcl.getRemainingCloudletLength() == 0.0) { if (rcl.getRemainingCloudletLength() == 0) {
cloudletFinish(rcl); cloudletFinish(rcl);
} else { } else {
rcl.setCloudletStatus(Cloudlet.PAUSED); rcl.setCloudletStatus(Cloudlet.PAUSED);
......
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