#include <KBRTestApp.h>

Classes | |
| struct | MsgHandle |
| type for storing seen messages in a circular buffer, holds OverlayKey of the sender and SequenceNumber More... | |
Public Member Functions | |
| KBRTestApp () | |
| ~KBRTestApp () | |
Private Types | |
| typedef std::vector< MsgHandle > | MsgHandleBuf |
Private Member Functions | |
| void | initializeApp (int stage) |
| initializes derived class-attributes | |
| void | finishApp () |
| collects statistical data of derived app | |
| void | handleTimerEvent (cMessage *msg) |
| void | deliver (OverlayKey &key, cMessage *msg) |
| Common API function: handles delivered messages from overlay. | |
| void | forward (OverlayKey *key, cPacket **msg, NodeHandle *nextHopNode) |
| Common API function: handles messages from overlay to be forwarded. | |
| bool | checkSeen (const OverlayKey &key, int seqNum) |
| Checks if a message was already seen before. | |
| void | evaluateData (simtime_t timeDelay, int hopCount, long int bytes) |
| Analyses and records measuring data handed over from nodes that previously had been the destination for a test message from this module, called by receiver::handleMessage() at sendermodule. | |
| bool | handleRpcCall (BaseCallMessage *msg) |
| Processes Remote-Procedure-Call invocation messages. | |
| void | kbrTestCall (KbrTestCall *call) |
| void | handleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt) |
| This method is called if an RPC response has been received. | |
| void | handleRpcTimeout (BaseCallMessage *msg, const TransportAddress &dest, cPolymorphic *context, int rpcId, const OverlayKey &destKey) |
| This method is called if an RPC timeout has been reached. | |
| void | handleLookupResponse (LookupResponse *msg, cObject *context, simtime_t latency) |
| void | pingResponse (PingResponse *response, cPolymorphic *context, int rpcId, simtime_t rtt) |
| virtual void | handleNodeLeaveNotification () |
| This method gets call **.gracefulLeaveDelay seconds before it is killed. | |
| OverlayKey | createDestKey () |
Private Attributes | |
| bool | kbrOneWayTest |
| bool | kbrRpcTest |
| bool | kbrLookupTest |
| int | testMsgSize |
| double | mean |
| mean time interval between sending test messages | |
| double | deviation |
| deviation of time interval | |
| bool | activeNetwInitPhase |
| is app active in network init phase? | |
| bool | lookupNodeIds |
| lookup only existing nodeIDs | |
| bool | nodeIsLeavingSoon |
| true if the node is going to be killed shortly | |
| uint32_t | numSent |
| uint32_t | bytesSent |
| uint32_t | numDelivered |
| number of delivered packets | |
| uint32_t | bytesDelivered |
| number of delivered bytes | |
| uint32_t | numDropped |
| uint32_t | bytesDropped |
| uint32_t | numRpcSent |
| uint32_t | bytesRpcSent |
| uint32_t | numRpcDelivered |
| number of delivered packets | |
| uint32_t | bytesRpcDelivered |
| number of delivered bytes | |
| uint32_t | numRpcDropped |
| uint32_t | bytesRpcDropped |
| simtime_t | rpcSuccLatencySum |
| uint32_t | rpcSuccLatencyCount |
| simtime_t | rpcTotalLatencySum |
| uint32_t | rpcTotalLatencyCount |
| uint32_t | numLookupSent |
| uint32_t | numLookupSuccess |
| uint32_t | numLookupFailed |
| cMessage * | onewayTimer |
| cMessage * | rpcTimer |
| cMessage * | lookupTimer |
| simtime_t | failureLatency |
| this latency is recorded for failed lookups and RPCs | |
| uint32_t | sequenceNumber |
| int | msgHandleBufSize |
| how many MsgHandles to store in circular buffer | |
| MsgHandleBuf | mhBuf |
| circular buffer of MsgHandles | |
| MsgHandleBuf::iterator | mhBufBegin |
| begin of circular buffer | |
| MsgHandleBuf::iterator | mhBufNext |
| next element to insert | |
| MsgHandleBuf::iterator | mhBufEnd |
| end of circular buffer | |
Test application for KBR interface that sends periodically test messages to random keys or existing nodeIDs. The receiver does not send back any answer, but sender::evaluateDate() is called.
Definition at line 43 of file KBRTestApp.h.
typedef std::vector<MsgHandle> KBRTestApp::MsgHandleBuf [private] |
Definition at line 73 of file KBRTestApp.h.
| KBRTestApp::KBRTestApp | ( | ) |
| KBRTestApp::~KBRTestApp | ( | ) |
Definition at line 40 of file KBRTestApp.cc.
00041 { 00042 cancelAndDelete(onewayTimer); 00043 cancelAndDelete(rpcTimer); 00044 cancelAndDelete(lookupTimer); 00045 }
| bool KBRTestApp::checkSeen | ( | const OverlayKey & | key, | |
| int | seqNum | |||
| ) | [private] |
Checks if a message was already seen before.
If the sequence number of the message is new for the given sender key, it is stored in a circular buffer and false is returned.
| key | the OverlayKey of the sender | |
| seqNum | sequence number of the message to check |
Definition at line 438 of file KBRTestApp.cc.
Referenced by deliver().
00439 { 00440 MsgHandle hdl(key, seqNum); 00441 00442 for (MsgHandleBuf::iterator it = mhBufBegin; it != mhBufEnd; ++it) { 00443 if (it->key.isUnspecified()) { 00444 continue; 00445 } 00446 00447 if (*it == hdl) { 00448 return true; 00449 } 00450 } 00451 00452 *(mhBufNext++) = hdl; 00453 if (mhBufNext == mhBufEnd) { 00454 mhBufNext = mhBufBegin; 00455 } 00456 return false; 00457 }
| OverlayKey KBRTestApp::createDestKey | ( | ) | [private] |
Definition at line 429 of file KBRTestApp.cc.
Referenced by handleTimerEvent().
00430 { 00431 if (lookupNodeIds) { 00432 return globalNodeList->getRandomNode(0, true, true).getKey(); 00433 } 00434 // generate random destination key 00435 return OverlayKey::random(); 00436 }
| void KBRTestApp::deliver | ( | OverlayKey & | key, | |
| cMessage * | msg | |||
| ) | [private, virtual] |
Common API function: handles delivered messages from overlay.
method to handle decapsulated KBRdeliver messages from overlay module, should be overwritten in derived application
| key | destination key | |
| msg | delivered message |
Reimplemented from BaseApp.
Definition at line 362 of file KBRTestApp.cc.
00363 { 00364 KBRTestMessage* testMsg = check_and_cast<KBRTestMessage*>(msg); 00365 OverlayCtrlInfo* overlayCtrlInfo = 00366 check_and_cast<OverlayCtrlInfo*>(msg->removeControlInfo()); 00367 00368 if (overlay->getThisNode().getKey().isUnspecified()) 00369 error("key"); 00370 00371 // check for duplicate 00372 if ((msgHandleBufSize > 0 ) 00373 && checkSeen(overlayCtrlInfo->getSrcNode().getKey(), testMsg->getSeqNum())) { 00374 EV << "[KBRTestApp::deliver() @ " << overlay->getThisNode().getAddress() 00375 << " (" << overlay->getThisNode().getKey().toString(16) << ")]\n" 00376 << " Duplicate dropped." 00377 << endl; 00378 delete overlayCtrlInfo; 00379 delete testMsg; 00380 return; 00381 } 00382 00383 // Return statistical data to the sender. 00384 if (cModule* mod = simulation.getModule(testMsg->getId())) { 00385 if (KBRTestApp* sender = dynamic_cast<KBRTestApp*>(mod)) { 00386 if ((!lookupNodeIds) || (overlay->getThisNode().getKey() == key)) { 00387 if (testMsg->getMeasurementPhase() == true) { 00388 sender->evaluateData((simTime() - testMsg->getCreationTime()), 00389 overlayCtrlInfo->getHopCount(), 00390 testMsg->getByteLength()); 00391 } 00392 } else if(lookupNodeIds) { 00393 if (testMsg->getMeasurementPhase() == true) { 00394 RECORD_STATS(numDropped++; 00395 bytesDropped += testMsg->getByteLength()); 00396 } 00397 EV << "[KBRTestApp::deliver() @ " << overlay->getThisNode().getAddress() 00398 << " (" << overlay->getThisNode().getKey().toString(16) << ")]\n" 00399 << " Error: Lookup of NodeIDs and KBRTestMessage" 00400 << " received with different destKey!" 00401 << endl; 00402 } 00403 } 00404 } 00405 00406 EV << "[KBRTestApp::deliver() @ " << overlay->getThisNode().getAddress() 00407 << " (" << overlay->getThisNode().getKey().toString(16) << ")]\n" 00408 << " Received \"" << testMsg->getName() << "(seqNr: " 00409 << testMsg->getSeqNum() << ")\n" 00410 << " with destination key: " << key.toString(16) 00411 << endl; 00412 00413 delete overlayCtrlInfo; 00414 delete testMsg; 00415 }
| void KBRTestApp::evaluateData | ( | simtime_t | timeDelay, | |
| int | hopCount, | |||
| long int | bytes | |||
| ) | [private] |
Analyses and records measuring data handed over from nodes that previously had been the destination for a test message from this module, called by receiver::handleMessage() at sendermodule.
| timeDelay | packet-delay | |
| hopCount | packet hop-count | |
| bytes | packet size in bytes |
Definition at line 459 of file KBRTestApp.cc.
00460 { 00461 // count the number and size of successfully delivered messages 00462 RECORD_STATS(numDelivered++; bytesDelivered += bytes; 00463 globalStatistics->deliveredKBRTestAppMessages++); 00464 00465 if (numSent < numDelivered) { 00466 error("KBRTestApp::evaluateData(): numSent < numDelivered!"); 00467 } 00468 00469 RECORD_STATS(globalStatistics->recordOutVector("KBRTestApp: One-way Hop " 00470 "Count", hopCount)); 00471 RECORD_STATS(globalStatistics->recordOutVector("KBRTestApp: One-way Latency", 00472 SIMTIME_DBL(latency))); 00473 }
| void KBRTestApp::finishApp | ( | ) | [private, virtual] |
collects statistical data of derived app
Reimplemented from BaseApp.
Definition at line 475 of file KBRTestApp.cc.
00476 { 00477 simtime_t time = globalStatistics->calcMeasuredLifetime(creationTime); 00478 00479 if (time >= GlobalStatistics::MIN_MEASURED) { 00480 if (kbrOneWayTest) { 00481 globalStatistics->addStdDev("KBRTestApp: One-way Delivered Messages/s", 00482 numDelivered / time); 00483 globalStatistics->addStdDev("KBRTestApp: One-way Delivered Bytes/s", 00484 bytesDelivered / time); 00485 globalStatistics->addStdDev("KBRTestApp: One-way Dropped Messages/s", 00486 numDropped / time); 00487 globalStatistics->addStdDev("KBRTestApp: One-way Dropped Bytes/s", 00488 bytesDropped / time); 00489 if (numSent > 0) { 00490 globalStatistics->addStdDev("KBRTestApp: One-way Delivery Ratio", 00491 (float)numDelivered / 00492 (float)numSent); 00493 } 00494 } 00495 00496 if (kbrRpcTest) { 00497 globalStatistics->addStdDev("KBRTestApp: RPC Delivered Messages/s", 00498 numRpcDelivered / time); 00499 globalStatistics->addStdDev("KBRTestApp: RPC Delivered Bytes/s", 00500 bytesRpcDelivered / time); 00501 globalStatistics->addStdDev("KBRTestApp: RPC Dropped Messages/s", 00502 numRpcDropped / time); 00503 globalStatistics->addStdDev("KBRTestApp: RPC Dropped Bytes/s", 00504 bytesRpcDropped / time); 00505 #if 0 00506 if (rpcSuccLatencyCount > 0) { 00507 globalStatistics->addStdDev("KBRTestApp: RPC Success Session Latency", 00508 SIMTIME_DBL(rpcSuccLatencySum) / rpcSuccLatencyCount); 00509 } 00510 00511 if (rpcTotalLatencyCount > 0) { 00512 globalStatistics->addStdDev("KBRTestApp: RPC Total Session Latency", 00513 SIMTIME_DBL(rpcTotalLatencySum) / rpcTotalLatencyCount); 00514 } 00515 #endif 00516 00517 if (numRpcSent > 0) { 00518 globalStatistics->addStdDev("KBRTestApp: RPC Delivery Ratio", 00519 (float)numRpcDelivered / 00520 (float)numRpcSent); 00521 } 00522 } 00523 00524 if (kbrLookupTest) { 00525 globalStatistics->addStdDev("KBRTestApp: Successful Lookups/s", 00526 numLookupSuccess / time); 00527 globalStatistics->addStdDev("KBRTestApp: Failed Lookups/s", 00528 numLookupFailed / time); 00529 if (numLookupSent > 0) { 00530 globalStatistics->addStdDev("KBRTestApp: Lookup Success Ratio", 00531 (float)numLookupSuccess / 00532 (float)numLookupSent); 00533 } 00534 } 00535 } 00536 }
| void KBRTestApp::forward | ( | OverlayKey * | key, | |
| cPacket ** | msg, | |||
| NodeHandle * | nextHopNode | |||
| ) | [private, virtual] |
Common API function: handles messages from overlay to be forwarded.
method to handle decapsulated KBRdeliver messages from overlay module, should be overwritten in derived application if needed
| key | destination key | |
| msg | message to forward | |
| nextHopNode | next hop |
Reimplemented from BaseApp.
Definition at line 417 of file KBRTestApp.cc.
00419 { 00420 KBRTestMessage* tempMsg = dynamic_cast<KBRTestMessage*>(*msg); 00421 00422 if (tempMsg == NULL) return; 00423 00424 tempMsg->setVisitedNodesArraySize(tempMsg->getVisitedNodesArraySize() + 1); 00425 tempMsg->setVisitedNodes(tempMsg->getVisitedNodesArraySize() - 1, 00426 overlay->getThisNode().getAddress()); 00427 }
| void KBRTestApp::handleLookupResponse | ( | LookupResponse * | msg, | |
| cObject * | context, | |||
| simtime_t | latency | |||
| ) | [private] |
Definition at line 323 of file KBRTestApp.cc.
Referenced by handleRpcResponse().
00325 { 00326 EV << "[KBRTestApp::handleLookupResponse() @ " << overlay->getThisNode().getAddress() 00327 << " (" << overlay->getThisNode().getKey().toString(16) << ")]\n" 00328 << " Lookup response for key " << msg->getKey()<< " : "; 00329 00330 KbrRpcContext* kbrRpcContext = check_and_cast<KbrRpcContext*>(context); 00331 00332 if (kbrRpcContext->getMeasurementPhase() == true) { 00333 if (msg->getIsValid() && (!lookupNodeIds || 00334 (msg->getSiblingsArraySize() > 0 && 00335 msg->getSiblings(0).getKey() == msg->getKey()))) { 00336 RECORD_STATS(numLookupSuccess++); 00337 RECORD_STATS(globalStatistics->recordOutVector( 00338 "KBRTestApp: Lookup Success Latency", SIMTIME_DBL(latency))); 00339 RECORD_STATS(globalStatistics->recordOutVector( 00340 "KBRTestApp: Lookup Total Latency", SIMTIME_DBL(latency))); 00341 RECORD_STATS(globalStatistics->recordOutVector( 00342 "KBRTestApp: Lookup Hop Count", msg->getHopCount())); 00343 } else { 00344 RECORD_STATS(numLookupFailed++); 00345 // for failed lookups add failureLatency to latency statistics vector 00346 RECORD_STATS(globalStatistics->recordOutVector( 00347 "KBRTestApp: Lookup Total Latency", 00348 SIMTIME_DBL(failureLatency))); 00349 RECORD_STATS(globalStatistics->recordOutVector( 00350 "KBRTestApp: Failed Lookup Hop Count", msg->getHopCount())); 00351 } 00352 } 00353 00354 delete kbrRpcContext; 00355 }
| void KBRTestApp::handleNodeLeaveNotification | ( | ) | [private, virtual] |
This method gets call **.gracefulLeaveDelay seconds before it is killed.
Reimplemented from BaseApp.
Definition at line 357 of file KBRTestApp.cc.
00358 { 00359 nodeIsLeavingSoon = true; 00360 }
| bool KBRTestApp::handleRpcCall | ( | BaseCallMessage * | msg | ) | [private, virtual] |
Processes Remote-Procedure-Call invocation messages.
This method should be overloaded when the overlay provides RPC functionality.
Reimplemented from BaseRpc.
Definition at line 217 of file KBRTestApp.cc.
00218 { 00219 RPC_SWITCH_START( msg ); 00220 RPC_DELEGATE( KbrTest, kbrTestCall ); 00221 RPC_SWITCH_END( ); 00222 00223 return RPC_HANDLED; 00224 }
| void KBRTestApp::handleRpcResponse | ( | BaseResponseMessage * | msg, | |
| cPolymorphic * | context, | |||
| int | rpcId, | |||
| simtime_t | rtt | |||
| ) | [private, virtual] |
This method is called if an RPC response has been received.
| msg | The response message. | |
| context | Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code | |
| rpcId | The RPC id. | |
| rtt | The Round-Trip-Time of this RPC |
Reimplemented from RpcListener.
Definition at line 232 of file KBRTestApp.cc.
00235 { 00236 RPC_SWITCH_START(msg) 00237 RPC_ON_RESPONSE(Lookup) { 00238 EV << "[KBRTestApp::handleRpcResponse() @ " << overlay->getThisNode().getAddress() 00239 << " (" << overlay->getThisNode().getKey().toString(16) << ")]\n" 00240 << " Lookup RPC Response received: id=" << rpcId << "\n" 00241 << " msg=" << *_LookupResponse << " rtt=" << rtt 00242 << endl; 00243 handleLookupResponse(_LookupResponse, context, rtt); 00244 break; 00245 } 00246 RPC_ON_RESPONSE(KbrTest) { 00247 KbrRpcContext* kbrRpcContext = check_and_cast<KbrRpcContext*>(context); 00248 if (kbrRpcContext->getMeasurementPhase() == true) { 00249 if (!lookupNodeIds || 00250 kbrRpcContext->getDestKey() == msg->getSrcNode().getKey()) { 00251 00252 RECORD_STATS(numRpcDelivered++; 00253 bytesRpcDelivered += msg->getByteLength()); 00254 RECORD_STATS(globalStatistics->recordOutVector( 00255 "KBRTestApp: RPC Success Latency", SIMTIME_DBL(rtt))); 00256 RECORD_STATS(globalStatistics->recordOutVector( 00257 "KBRTestApp: RPC Total Latency", SIMTIME_DBL(rtt))); 00258 RECORD_STATS(rpcSuccLatencyCount++; 00259 rpcSuccLatencySum += SIMTIME_DBL(rtt)); 00260 RECORD_STATS(rpcTotalLatencyCount++; 00261 rpcTotalLatencySum += SIMTIME_DBL(rtt)); 00262 OverlayCtrlInfo* overlayCtrlInfo = 00263 dynamic_cast<OverlayCtrlInfo*>(msg->getControlInfo()); 00264 00265 uint16_t hopSum = msg->getCallHopCount(); 00266 hopSum += (overlayCtrlInfo ? overlayCtrlInfo->getHopCount() : 1); 00267 RECORD_STATS(globalStatistics->recordOutVector( 00268 "KBRTestApp: RPC Hop Count", hopSum)); 00269 } else { 00270 RECORD_STATS(numRpcDropped++; 00271 bytesRpcDropped += msg->getByteLength()); 00272 // for failed RPCs add failureLatency to latency statistics vector 00273 RECORD_STATS(globalStatistics->recordOutVector( 00274 "KBRTestApp: RPC Total Latency", 00275 SIMTIME_DBL(failureLatency))); 00276 RECORD_STATS(rpcTotalLatencyCount++; 00277 rpcTotalLatencySum += SIMTIME_DBL(failureLatency)); 00278 } 00279 } 00280 delete kbrRpcContext; 00281 break; 00282 } 00283 RPC_SWITCH_END( ) 00284 }
| void KBRTestApp::handleRpcTimeout | ( | BaseCallMessage * | msg, | |
| const TransportAddress & | dest, | |||
| cPolymorphic * | context, | |||
| int | rpcId, | |||
| const OverlayKey & | destKey | |||
| ) | [private, virtual] |
This method is called if an RPC timeout has been reached.
| msg | The original RPC message. | |
| dest | The destination node | |
| context | Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code | |
| rpcId | The RPC id. | |
| destKey | the destination OverlayKey |
Reimplemented from RpcListener.
Definition at line 286 of file KBRTestApp.cc.
00290 { 00291 RPC_SWITCH_START(msg) 00292 RPC_ON_CALL(KbrTest) { 00293 KbrRpcContext* kbrRpcContext = check_and_cast<KbrRpcContext*>(context); 00294 if (kbrRpcContext->getMeasurementPhase() == true) { 00295 RECORD_STATS(numRpcDropped++; 00296 bytesRpcDropped += msg->getByteLength()); 00297 // for failed RPCs add failureLatency to latency statistics vector 00298 RECORD_STATS(globalStatistics->recordOutVector( 00299 "KBRTestApp: RPC Total Latency", 00300 SIMTIME_DBL(failureLatency))); 00301 RECORD_STATS(rpcTotalLatencyCount++; 00302 rpcTotalLatencySum += SIMTIME_DBL(failureLatency)); 00303 00304 } 00305 break; 00306 } 00307 RPC_ON_CALL(Lookup) { 00308 KbrRpcContext* kbrRpcContext = check_and_cast<KbrRpcContext*>(context); 00309 if (kbrRpcContext->getMeasurementPhase() == true) { 00310 RECORD_STATS(numLookupFailed++); 00311 // for failed lookups add failureLatency to latency statistics vector 00312 RECORD_STATS(globalStatistics->recordOutVector( 00313 "KBRTestApp: Lookup Total Latency", 00314 SIMTIME_DBL(failureLatency))); 00315 } 00316 break; 00317 } 00318 RPC_SWITCH_END() 00319 00320 delete context; 00321 }
| void KBRTestApp::handleTimerEvent | ( | cMessage * | msg | ) | [private, virtual] |
Reimplemented from BaseRpc.
Definition at line 140 of file KBRTestApp.cc.
00141 { 00142 // schedule next timer event 00143 scheduleAt(simTime() + truncnormal(mean, deviation), msg); 00144 00145 // do nothing if the network is still in the initialization phase 00146 if ((!activeNetwInitPhase && underlayConfigurator->isInInitPhase()) 00147 || underlayConfigurator->isSimulationEndingSoon() 00148 || nodeIsLeavingSoon) { 00149 return; 00150 } 00151 00152 OverlayKey destKey; 00153 00154 if (msg == onewayTimer) { 00155 // TEST 1: route a test message to a key (one-way) 00156 destKey = createDestKey(); 00157 // do nothing if there are currently no nodes in the network 00158 if (!destKey.isUnspecified()) { 00159 // create a 100 byte test message 00160 KBRTestMessage* testMsg = new KBRTestMessage("KBRTestMessage"); 00161 testMsg->setId(getId()); 00162 testMsg->setSeqNum(sequenceNumber++); 00163 testMsg->setByteLength(testMsgSize); 00164 testMsg->setMeasurementPhase(globalStatistics->isMeasuring()); 00165 00166 RECORD_STATS(globalStatistics->sentKBRTestAppMessages++; 00167 numSent++; bytesSent += testMsg->getByteLength()); 00168 00169 callRoute(destKey, testMsg); 00170 } 00171 } else if (msg == rpcTimer) { 00172 // TEST 2: send a remote procedure call to a specific key and wait for a response 00173 destKey = createDestKey(); 00174 // do nothing if there are currently no nodes in the network 00175 if (!destKey.isUnspecified()) { 00176 KbrTestCall* call = new KbrTestCall; 00177 call->setByteLength(testMsgSize); 00178 KbrRpcContext* context = new KbrRpcContext; 00179 context->setDestKey(destKey); 00180 context->setMeasurementPhase(globalStatistics->isMeasuring()); 00181 00182 RECORD_STATS(numRpcSent++; 00183 bytesRpcSent += call->getByteLength()); 00184 00185 sendRouteRpcCall(TIER1_COMP, destKey, call, context); 00186 } 00187 } else /*if (msg == lookupTimer &&)*/ { 00188 // TEST 3: perform a lookup of a specific key 00189 destKey = createDestKey(); 00190 // do nothing if there are currently no nodes in the network 00191 if (!destKey.isUnspecified()) { 00192 LookupCall* call = new LookupCall(); 00193 call->setKey(destKey); 00194 call->setNumSiblings(overlay->getMaxNumSiblings()); 00195 KbrRpcContext* context = new KbrRpcContext; 00196 context->setDestKey(destKey); 00197 context->setMeasurementPhase(globalStatistics->isMeasuring()); 00198 sendInternalRpcCall(OVERLAY_COMP, call, context); 00199 00200 RECORD_STATS(numLookupSent++); 00201 } 00202 } 00203 00204 #if 0 00205 thisNode.setPort(1025); 00206 NodeHandle handle = globalNodeList->getBootstrapNode(); 00207 handle.setPort(1025); 00208 pingNode(handle, -1, -1, NULL, "TestPING", NULL, -1, UDP_TRANSPORT); 00209 #endif 00210 00211 }
| void KBRTestApp::initializeApp | ( | int | stage | ) | [private, virtual] |
initializes derived class-attributes
| stage | the init stage |
Reimplemented from BaseApp.
Definition at line 47 of file KBRTestApp.cc.
00048 { 00049 if (stage != MIN_STAGE_APP) { 00050 return; 00051 } 00052 00053 kbrOneWayTest = par("kbrOneWayTest"); 00054 kbrRpcTest = par("kbrRpcTest"); 00055 kbrLookupTest = par("kbrLookupTest"); 00056 00057 if (!kbrOneWayTest && !kbrRpcTest && !kbrLookupTest) { 00058 throw cRuntimeError("KBRTestApp::initializeApp(): nothing to do!"); 00059 } 00060 00061 failureLatency = par("failureLatency"); 00062 00063 testMsgSize = par("testMsgSize"); 00064 lookupNodeIds = par("lookupNodeIds"); 00065 mean = par("testMsgInterval"); 00066 deviation = mean / 10; 00067 activeNetwInitPhase = par("activeNetwInitPhase"); 00068 msgHandleBufSize = par("msgHandleBufSize"); 00069 00070 numSent = 0; 00071 bytesSent = 0; 00072 numDelivered = 0; 00073 bytesDelivered = 0; 00074 numDropped = 0; 00075 bytesDropped = 0; 00076 WATCH(numSent); 00077 WATCH(bytesSent); 00078 WATCH(numDelivered); 00079 WATCH(bytesDelivered); 00080 WATCH(numDropped); 00081 WATCH(bytesDropped); 00082 00083 numRpcSent = 0; 00084 bytesRpcSent = 0; 00085 numRpcDelivered = 0; 00086 bytesRpcDelivered = 0; 00087 numRpcDropped = 0; 00088 bytesRpcDropped = 0; 00089 rpcSuccLatencyCount = 0; 00090 rpcSuccLatencySum = 0; 00091 rpcTotalLatencyCount = 0; 00092 rpcTotalLatencySum = 0; 00093 WATCH(numRpcSent); 00094 WATCH(bytesRpcSent); 00095 WATCH(numRpcDelivered); 00096 WATCH(bytesRpcDelivered); 00097 WATCH(numRpcDropped); 00098 WATCH(bytesRpcDropped); 00099 00100 numLookupSent = 0; 00101 numLookupSuccess = 0; 00102 numLookupFailed = 0; 00103 WATCH(numLookupSent); 00104 WATCH(numLookupSuccess); 00105 WATCH(numLookupFailed); 00106 00107 sequenceNumber = 0; 00108 00109 nodeIsLeavingSoon = false; 00110 00111 // initialize circular buffer 00112 if (msgHandleBufSize > 0) { 00113 mhBuf.resize(msgHandleBufSize); 00114 mhBufBegin = mhBuf.begin(); 00115 mhBufEnd = mhBuf.end(); 00116 mhBufNext = mhBufBegin; 00117 } 00118 00119 #if 0 00120 bindToPort(1025); 00121 thisNode.setPort(1025); 00122 #endif 00123 00124 // start periodic timer 00125 onewayTimer = new cMessage("onewayTimer"); 00126 rpcTimer = new cMessage("rpcTimer"); 00127 lookupTimer = new cMessage("lookupTimer"); 00128 00129 if (kbrOneWayTest) { 00130 scheduleAt(simTime() + truncnormal(mean, deviation), onewayTimer); 00131 } 00132 if (kbrRpcTest) { 00133 scheduleAt(simTime() + truncnormal(mean, deviation), rpcTimer); 00134 } 00135 if (kbrLookupTest) { 00136 scheduleAt(simTime() + truncnormal(mean, deviation), lookupTimer); 00137 } 00138 }
| void KBRTestApp::kbrTestCall | ( | KbrTestCall * | call | ) | [private] |
Definition at line 225 of file KBRTestApp.cc.
Referenced by handleRpcCall().
00226 { 00227 KbrTestResponse* response = new KbrTestResponse; 00228 response->setByteLength(call->getByteLength()); 00229 sendRpcResponse(call, response); 00230 }
| void KBRTestApp::pingResponse | ( | PingResponse * | response, | |
| cPolymorphic * | context, | |||
| int | rpcId, | |||
| simtime_t | rtt | |||
| ) | [private, virtual] |
bool KBRTestApp::activeNetwInitPhase [private] |
is app active in network init phase?
Definition at line 135 of file KBRTestApp.h.
Referenced by handleTimerEvent(), and initializeApp().
uint32_t KBRTestApp::bytesDelivered [private] |
number of delivered bytes
Definition at line 142 of file KBRTestApp.h.
Referenced by evaluateData(), finishApp(), and initializeApp().
uint32_t KBRTestApp::bytesDropped [private] |
Definition at line 144 of file KBRTestApp.h.
Referenced by deliver(), finishApp(), and initializeApp().
uint32_t KBRTestApp::bytesRpcDelivered [private] |
number of delivered bytes
Definition at line 149 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), and initializeApp().
uint32_t KBRTestApp::bytesRpcDropped [private] |
Definition at line 151 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), handleRpcTimeout(), and initializeApp().
uint32_t KBRTestApp::bytesRpcSent [private] |
uint32_t KBRTestApp::bytesSent [private] |
double KBRTestApp::deviation [private] |
deviation of time interval
Definition at line 134 of file KBRTestApp.h.
Referenced by handleTimerEvent(), and initializeApp().
simtime_t KBRTestApp::failureLatency [private] |
this latency is recorded for failed lookups and RPCs
Definition at line 169 of file KBRTestApp.h.
Referenced by handleLookupResponse(), handleRpcResponse(), handleRpcTimeout(), and initializeApp().
bool KBRTestApp::kbrLookupTest [private] |
bool KBRTestApp::kbrOneWayTest [private] |
bool KBRTestApp::kbrRpcTest [private] |
bool KBRTestApp::lookupNodeIds [private] |
lookup only existing nodeIDs
Definition at line 136 of file KBRTestApp.h.
Referenced by createDestKey(), deliver(), handleLookupResponse(), handleRpcResponse(), and initializeApp().
cMessage* KBRTestApp::lookupTimer [private] |
double KBRTestApp::mean [private] |
mean time interval between sending test messages
Definition at line 133 of file KBRTestApp.h.
Referenced by handleTimerEvent(), and initializeApp().
MsgHandleBuf KBRTestApp::mhBuf [private] |
circular buffer of MsgHandles
Definition at line 173 of file KBRTestApp.h.
Referenced by initializeApp().
MsgHandleBuf::iterator KBRTestApp::mhBufBegin [private] |
begin of circular buffer
Definition at line 174 of file KBRTestApp.h.
Referenced by checkSeen(), and initializeApp().
MsgHandleBuf::iterator KBRTestApp::mhBufEnd [private] |
end of circular buffer
Definition at line 176 of file KBRTestApp.h.
Referenced by checkSeen(), and initializeApp().
MsgHandleBuf::iterator KBRTestApp::mhBufNext [private] |
next element to insert
Definition at line 175 of file KBRTestApp.h.
Referenced by checkSeen(), and initializeApp().
int KBRTestApp::msgHandleBufSize [private] |
how many MsgHandles to store in circular buffer
Definition at line 172 of file KBRTestApp.h.
Referenced by deliver(), and initializeApp().
bool KBRTestApp::nodeIsLeavingSoon [private] |
true if the node is going to be killed shortly
Definition at line 137 of file KBRTestApp.h.
Referenced by handleNodeLeaveNotification(), handleTimerEvent(), and initializeApp().
uint32_t KBRTestApp::numDelivered [private] |
number of delivered packets
Definition at line 141 of file KBRTestApp.h.
Referenced by evaluateData(), finishApp(), and initializeApp().
uint32_t KBRTestApp::numDropped [private] |
Definition at line 143 of file KBRTestApp.h.
Referenced by deliver(), finishApp(), and initializeApp().
uint32_t KBRTestApp::numLookupFailed [private] |
Definition at line 161 of file KBRTestApp.h.
Referenced by finishApp(), handleLookupResponse(), handleRpcTimeout(), and initializeApp().
uint32_t KBRTestApp::numLookupSent [private] |
Definition at line 159 of file KBRTestApp.h.
Referenced by finishApp(), handleTimerEvent(), and initializeApp().
uint32_t KBRTestApp::numLookupSuccess [private] |
Definition at line 160 of file KBRTestApp.h.
Referenced by finishApp(), handleLookupResponse(), and initializeApp().
uint32_t KBRTestApp::numRpcDelivered [private] |
number of delivered packets
Definition at line 148 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), and initializeApp().
uint32_t KBRTestApp::numRpcDropped [private] |
Definition at line 150 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), handleRpcTimeout(), and initializeApp().
uint32_t KBRTestApp::numRpcSent [private] |
Definition at line 146 of file KBRTestApp.h.
Referenced by finishApp(), handleTimerEvent(), and initializeApp().
uint32_t KBRTestApp::numSent [private] |
Definition at line 139 of file KBRTestApp.h.
Referenced by evaluateData(), finishApp(), handleTimerEvent(), and initializeApp().
cMessage* KBRTestApp::onewayTimer [private] |
Definition at line 165 of file KBRTestApp.h.
Referenced by handleTimerEvent(), initializeApp(), KBRTestApp(), and ~KBRTestApp().
uint32_t KBRTestApp::rpcSuccLatencyCount [private] |
Definition at line 154 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), and initializeApp().
simtime_t KBRTestApp::rpcSuccLatencySum [private] |
Definition at line 153 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), and initializeApp().
cMessage* KBRTestApp::rpcTimer [private] |
Definition at line 166 of file KBRTestApp.h.
Referenced by handleTimerEvent(), initializeApp(), and ~KBRTestApp().
uint32_t KBRTestApp::rpcTotalLatencyCount [private] |
Definition at line 157 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), handleRpcTimeout(), and initializeApp().
simtime_t KBRTestApp::rpcTotalLatencySum [private] |
Definition at line 156 of file KBRTestApp.h.
Referenced by finishApp(), handleRpcResponse(), handleRpcTimeout(), and initializeApp().
uint32_t KBRTestApp::sequenceNumber [private] |
int KBRTestApp::testMsgSize [private] |
1.5.8