24 #include <IPAddressResolver.h>
63 throw cRuntimeError(
"KBRTestApp::initializeApp(): "
64 "no tests are configured!");
71 mean = par(
"testMsgInterval");
147 rpcTimer =
new cMessage(
"rpcTimer");
175 std::pair<OverlayKey,TransportAddress> dest =
createDestKey();
176 if (!dest.first.isUnspecified()) {
179 testMsg->
setId(getId());
192 std::pair<OverlayKey,TransportAddress> dest =
createDestKey();
193 if (!dest.first.isUnspecified()) {
212 std::pair<OverlayKey,TransportAddress> dest =
createDestKey();
213 if (!dest.first.isUnspecified()) {
234 if (address == NULL) {
235 EV <<
"no node!!!" << std::endl;
267 int rpcId, simtime_t rtt)
287 response->setByteLength(call->getByteLength());
295 response->setByteLength(call->getByteLength());
302 cPolymorphic* context,
int rpcId,
309 <<
" Lookup RPC Response received: id=" << rpcId <<
"\n"
310 <<
" msg=" << *_LookupResponse <<
" rtt=" << rtt
325 "KBRTestApp: RPC Success Latency", SIMTIME_DBL(rtt)));
327 "KBRTestApp: RPC Total Latency", SIMTIME_DBL(rtt)));
336 hopSum += (overlayCtrlInfo ? overlayCtrlInfo->getHopCount() : 1);
338 "KBRTestApp: RPC Hop Count", hopSum));
349 "KBRTestApp: RPC Total Latency",
355 delete kbrRpcContext;
364 "KBRTestApp: Underlay RTT", SIMTIME_DBL(rtt)));
366 "KBRTestApp: Underlay One-way Latency",
367 SIMTIME_DBL(_UnderlayTestResponse->getOneWayLatency())));
369 delete kbrRpcContext;
377 cPolymorphic* context,
int rpcId,
382 EV <<
"[KBRTestApp::handleRpcTimeout() @ "
385 <<
" KBR-Test RPC Response timeout: id=" << rpcId
402 "KBRTestApp: RPC Total Latency",
416 "KBRTestApp: Lookup Total Latency",
427 cObject* context, simtime_t latency)
431 <<
" Lookup response for key " << msg->
getKey()<<
" : ";
442 "KBRTestApp: Lookup Success Latency", SIMTIME_DBL(latency)));
444 "KBRTestApp: Lookup Total Latency", SIMTIME_DBL(latency)));
446 "KBRTestApp: Lookup Hop Count", msg->
getHopCount()));
450 std::cout <<
"invalid" << std::endl;
452 std::cout <<
"empty" << std::endl;
454 std::cout <<
"wrong key" << std::endl;
460 "KBRTestApp: Lookup Total Latency",
463 "KBRTestApp: Failed Lookup Hop Count", msg->
getHopCount()));
467 delete kbrRpcContext;
489 <<
" Duplicate dropped."
491 delete overlayCtrlInfo;
497 if (cModule* mod = simulation.getModule(testMsg->
getId())) {
498 if (
KBRTestApp* sender = dynamic_cast<KBRTestApp*>(mod)) {
501 sender->evaluateData((simTime() - testMsg->getCreationTime()),
502 overlayCtrlInfo->getHopCount(),
503 testMsg->getByteLength());
512 <<
" Error: Lookup of NodeIDs and KBRTestMessage"
513 <<
" received with different destKey!"
521 <<
" Received \"" << testMsg->getName() <<
"(seqNr: "
523 <<
" with destination key: " << key.
toString(16)
526 delete overlayCtrlInfo;
535 if (tempMsg == NULL)
return;
549 return std::make_pair(handle.
getKey(), handle);
560 if (it->key.isUnspecified()) {
583 std::ostringstream tempString;
584 tempString <<
"KBRTestApp::evaluateData(): numSent ("
586 throw cRuntimeError(tempString.str().c_str());
592 SIMTIME_DBL(latency)));