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
List<ResCloudlet> cloudletsToFinish = new ArrayList<ResCloudlet>();
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);
continue;
} else { //not finish: estimate the finish time
......
......@@ -91,7 +91,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
capacity /= cpus; // average capacity of each 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
......@@ -104,7 +104,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
int cont = 0;
List<ResCloudlet> toRemove = new ArrayList<ResCloudlet>();
for (ResCloudlet rcl : getCloudletExecList()) {
if (rcl.getRemainingCloudletLength() == 0.0) {// finished anyway, rounding issue...
if (rcl.getRemainingCloudletLength() == 0) {// finished anyway, rounding issue...
toRemove.add(rcl);
cloudletFinish(rcl);
finished++;
......@@ -173,7 +173,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
for (ResCloudlet rcl : getCloudletExecList()) {
if (rcl.getCloudletId() == cloudletId) {
getCloudletExecList().remove(rcl);
if (rcl.getRemainingCloudletLength() == 0.0) {
if (rcl.getRemainingCloudletLength() == 0) {
cloudletFinish(rcl);
} else {
rcl.setCloudletStatus(Cloudlet.CANCELED);
......@@ -230,7 +230,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
if (found){
//moves to the paused list
ResCloudlet rgl = getCloudletExecList().remove(position);
if (rgl.getRemainingCloudletLength() == 0.0) {
if (rgl.getRemainingCloudletLength() == 0) {
cloudletFinish(rgl);
} else {
rgl.setCloudletStatus(Cloudlet.PAUSED);
......@@ -254,7 +254,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
if (found) {
// moves to the paused list
ResCloudlet rgl = getCloudletWaitingList().remove(position);
if (rgl.getRemainingCloudletLength() == 0.0) {
if (rgl.getRemainingCloudletLength() == 0) {
cloudletFinish(rgl);
} else {
rgl.setCloudletStatus(Cloudlet.PAUSED);
......
......@@ -69,7 +69,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
double timeSpam = currentTime - getPreviousTime();
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) {
......@@ -82,8 +82,8 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
int i = 0;
List<ResCloudlet> toRemove = new ArrayList<ResCloudlet>();
for (ResCloudlet rcl : getCloudletExecList()) {
double remainingLength = rcl.getRemainingCloudletLength();
if (remainingLength == 0.00) {// finished: remove from the list
long remainingLength = rcl.getRemainingCloudletLength();
if (remainingLength == 0) {// finished: remove from the list
toRemove.add(rcl);
cloudletFinish(rcl);
continue;
......@@ -181,7 +181,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
if (found) {
ResCloudlet rcl = getCloudletExecList().remove(position);
if (rcl.getRemainingCloudletLength() == 0.0) {
if (rcl.getRemainingCloudletLength() == 0) {
cloudletFinish(rcl);
} else {
rcl.setCloudletStatus(Cloudlet.CANCELED);
......@@ -234,7 +234,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
if (found) {
// remove cloudlet from the exec list and put it in the paused list
ResCloudlet rcl = getCloudletExecList().remove(position);
if (rcl.getRemainingCloudletLength() == 0.0) {
if (rcl.getRemainingCloudletLength() == 0) {
cloudletFinish(rcl);
} else {
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