Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • 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