26 #define TRIGGER_TIMER 1234
28 #define STRETCH_HELLO 12345
29 #define STRETCH_HELLOACK 12346
30 #define STRETCH_I3MSG 12347
31 #define STRETCH_IPMSG 12348
33 #define USE_NO_SAMPLING 0
34 #define USE_QUERY_FLAG 1
35 #define USE_CLOSEST_ID 2
36 #define USE_SAMPLING (USE_QUERY_FLAG | USE_CLOSEST_ID)
77 void initializeApp(
int stage);
79 void handleTimerEvent(cMessage *msg);
80 void handleUDPMessage(cMessage* msg);
94 recordScalar(
"Number of samples", myStats[
STAT_RATIO].getCount());
96 recordScalar(
"IP Min ", myStats[
STAT_IP].getMin());
97 recordScalar(
"IP Max ", myStats[
STAT_IP].getMax());
98 recordScalar(
"IP Mean ", myStats[
STAT_IP].getMean());
99 recordScalar(
"IP Stdev", myStats[
STAT_IP].getStddev());
101 recordScalar(
"I3 Min ", myStats[
STAT_I3].getMin());
102 recordScalar(
"I3 Max ", myStats[
STAT_I3].getMax());
103 recordScalar(
"I3 Mean ", myStats[
STAT_I3].getMean());
104 recordScalar(
"I3 Stdev", myStats[
STAT_I3].getStddev());
106 recordScalar(
"Ratio Min ", myStats[
STAT_RATIO].getMin());
107 recordScalar(
"Ratio Max ", myStats[
STAT_RATIO].getMax());
108 recordScalar(
"Ratio Mean ", myStats[
STAT_RATIO].getMean());
109 recordScalar(
"Ratio Stdev", myStats[
STAT_RATIO].getStddev());
113 recordScalar(
"General Number of samples",
stats[
STAT_RATIO].getCount());
115 recordScalar(
"General IP Min ",
stats[
STAT_IP].getMin());
116 recordScalar(
"General IP Max ",
stats[
STAT_IP].getMax());
117 recordScalar(
"General IP Mean ",
stats[
STAT_IP].getMean());
118 recordScalar(
"General IP Stdev",
stats[
STAT_IP].getStddev());
121 recordScalar(
"General I3 Min ",
stats[
STAT_I3].getMin());
122 recordScalar(
"General I3 Max ",
stats[
STAT_I3].getMax());
123 recordScalar(
"General I3 Mean ",
stats[
STAT_I3].getMean());
124 recordScalar(
"General I3 Stdev",
stats[
STAT_I3].getStddev());
136 foundPartner =
false;
137 samplingType = par(
"useSampling");
139 generalId.createFromHash(
"LatencyStretch");
140 generalId.setName(
"LatencyStretch");
141 generalId.createRandomSuffix();
142 insertTrigger(generalId);
145 myId = retrieveClosestIdentifier();
147 myId.createRandomKey();
151 cMessage *msg =
new cMessage();
153 scheduleAt(simTime() + 5, msg);
157 if (msg->getContextPointer() != 0) {
160 if (!latencies.count(mc->
sourceIp)) opp_error(
"Unknown Id!");
179 latencies[nid->
address].i3Time = 0;
180 latencies[nid->
address].ipTime = 0;
185 msg->setContextPointer(nid);
200 if (!latencies.count(mc->
sourceIp)) opp_error(
"Unknown Id!");
207 if (simTime() > 100) {
234 cPacket *hmsg =
new cPacket();
241 hmsg->setContextPointer(nid);
245 int length = (intrand(512) + 32) * 8;
252 cPacket *i3msg =
new cPacket();
254 i3msg->setContextPointer(mc1);
255 i3msg->setBitLength(length);
258 cPacket *ipmsg =
new cPacket();
260 ipmsg->setContextPointer(mc2);
261 ipmsg->setBitLength(length);
264 sendThroughUDP(ipmsg, partner.address);
268 scheduleAt(simTime() + truncnormal(15, 5), msg);