Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to check execution completed tuple in iFogSim?

Description

In fog computing tuples are executed in different application modules. The “checkCloudletCompletion()” abstract method in FogDevice class to check which application module to complete the execution of tuples.

Source Code

protected void checkCloudletCompletion() {

boolean cloudletCompleted = false;

List <\? extends Host> list = getVmAllocationPolicy().getHostList();

for (int i = 0; i < list.size(); i++) {

Host host = list.get(i);

for (Vm vm : host.getVmList()) {

while (vm.getCloudletScheduler().isFinishedCloudlets()) {

Cloudlet cl = vm.getCloudletScheduler().getNextFinishedCloudlet();

if (cl != null) {

cloudletCompleted = true;

Tuple tuple = (Tuple) cl;

TimeKeeper.getInstance().tupleEndedExecution(tuple);

Application application = getApplicationMap().get(tuple.getAppId());

System.out.println("Completed execution of tuple " + tuple.getCloudletId() + " on " + tuple.getDestModuleName());

Logger.debug(getName(), "Completed execution of tuple " + tuple.getCloudletId() + "on " + tuple.getDestModuleName());

List resultantTuples = application.getResultantTuples(tuple.getDestModuleName(), tuple, getId(), vm.getId());

for (Tuple resTuple : resultantTuples) {

resTuple.setModuleCopyMap(new HashMap(tuple.getModuleCopyMap()));

resTuple.getModuleCopyMap().put(((AppModule) vm).getName(), vm.getId());

updateTimingsOnSending(resTuple);

sendToSelf(resTuple);

}

sendNow(cl.getUserId(), CloudSimTags.CLOUDLET_RETURN, cl);

}

}

}

}

if (cloudletCompleted) {

updateAllocatedMips(null);

}

}

Output

Check execution completed tuple in iFogSim