delay += random() % 2000 - 1000; // adjust by random from -1000..1000 range
auto now = microsec_clock::universal_time();
if (now - pkt->getTimestamp() > milliseconds(delay)) {
- //if (rx_times > 2) {
- // std::cout << xchg_type << " RX " << trans_id << ", times " << rx_times << ", delay " << delay << std::endl;
- //}
resent_cnt++;
total_resent_++;
Pkt6Ptr pkt6 = boost::dynamic_pointer_cast<Pkt6>(pkt);
IfaceMgr::instance().send(pkt6);
}
- //std::cout << "resent " << xchg_type << " " << pkt->getTransid() << " @ " << pkt->getTimestamp() << std::endl;
rx_times++;
retrans[trans_id] = rx_times;
}
if (resent_cnt > 0) {
auto now = microsec_clock::universal_time();
- std::cout << now << " " << xchg_type << ": still waiting for " << still_left_cnt << " answers, resent " << resent_cnt << ", retrying " << retrans.size() << std::endl;
+ std::cout << now << " " << xchg_type << ": still waiting for "
+ << still_left_cnt << " answers, resent " << resent_cnt
+ << ", retrying " << retrans.size() << std::endl;
}
return still_left_cnt;
}
uint32_t clients_num = options.getClientsNum() == 0 ?
1 : options.getClientsNum();
- // StatsMgr& stats_mgr(tc_.getStatsMgr());
+ StatsMgr& stats_mgr(tc_.getStatsMgr());
tc_.start();
// Pull some packets from receiver thread, process them, update some stats
// and respond to the server if needed.
tc_.consumeReceivedPackets();
+
usleep(100);
now = microsec_clock::universal_time();
break;
}
}
-
- // If we are sending Renews to the server, the Reply packets are cached
- // so as leases for which we send Renews can be identified. The major
- // issue with this approach is that most of the time we are caching
- // more packets than we actually need. This function removes excessive
- // Reply messages to reduce the memory and CPU utilization. Note that
- // searches in the long list of Reply packets increases CPU utilization.
- //tc_.cleanCachedPackets();
}
auto stop = microsec_clock::universal_time();
tc_.printStats();
- // // Print packet timestamps
- // if (testDiags('t')) {
- // stats_mgr.printTimestamps();
- // }
+ // Print packet timestamps
+ if (testDiags('t')) {
+ stats_mgr.printTimestamps();
+ }
// Print server id.
if (testDiags('s') && tc_.serverIdReceived()) {
<< " retransmissions needed, received " << (clients_num * 2)
<< " responses." << std::endl;
- int ret_code = 0;
- // // Check if any packet drops occurred.
- // ret_code = stats_mgr.droppedPackets() ? 3 : 0;
- return (ret_code);
+ return (0);
}
}
"the server.\n"
"The -r option is used to set up a performance test, without\n"
"it exchanges are initiated as fast as possible.\n"
+ "The other scenario is an avalanche which is selected by\n"
+ "--scenario avalanche. It first sends as many Discovery or Solicit\n"
+ "messages as request in -R option then back off mechanism is used for\n"
+ "each simulated client until all requests are answered. At the end\n"
+ "time of whole scenario is reported.\n"
"\n"
"Options:\n"
"-1: Take the server-ID option from the first received message.\n"
"-R<range>: Specify how many different clients are used. With 1\n"
" (the default), all requests seem to come from the same client.\n"
"-s<seed>: Specify the seed for randomization, making it repeatable.\n"
+ "--scenario <name>: where name is 'basic' (default) or 'avalanche'.\n"
"-S<srvid-offset>: Offset of the server-ID option in the\n"
" (second/request) template.\n"
"-T<template-file>: The name of a file containing the template to use\n"