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 calculate tuple delay in iFogSim?

Description

Fog computing enables the emergence of the latency-sensitive internet of things (IoT) network to support real-time applications. While the distance between sensing and processing is minimized in the fog network. “TupleEndedExecution()” abstact method implement for calculate the tuple delay.

Source Code

public void tupleEndedExecution(Tuple tuple){

if(!tupleIdToCpuStartTime.containsKey(tuple.getCloudletId()))

return;

double executionTime = CloudSim.clock() - tupleIdToCpuStartTime.get(tuple.getCloudletId());

if(!tupleTypeToAverageCpuTime.containsKey(tuple.getTupleType())){

tupleTypeToAverageCpuTime.put(tuple.getTupleType(), executionTime);

tupleTypeToExecutedTupleCount.put(tuple.getTupleType(), 1);

} else{

double currentAverage = tupleTypeToAverageCpuTime.get(tuple.getTupleType());

int currentCount = tupleTypeToExecutedTupleCount.get(tuple.getTupleType());

tupleTypeToAverageCpuTime.put(tuple.getTupleType(), (currentAverage*currentCount+executionTime)/(currentCount+1));

}

}

for(String tupleType : TimeKeeper.getInstance().getTupleTypeToAverageCpuTime().keySet()){

System.out.println(tupleType + " ---> "+TimeKeeper.getInstance().getTupleTypeToAverageCpuTime().get(tupleType));

}

Output

Calculate tuple delay in iFogSim