11#include <boost/date_time/posix_time/posix_time.hpp>
14using namespace boost::posix_time;
25 if (
tc_.interrupted()) {
34 if (period.length().total_seconds() >=
options_.getPeriod()) {
36 std::cout <<
"reached test-period." << std::endl;
38 if (!
tc_.waitToExit()) {
44 bool max_requests =
false;
46 if (
options_.getNumRequests().size() > 0) {
48 static_cast<uint64_t
>(
options_.getNumRequests()[0])) {
53 if (
options_.getNumRequests().size() > 1) {
55 static_cast<uint64_t
>(
options_.getNumRequests()[1])) {
61 std::cout <<
"Reached max requests limit." << std::endl;
63 if (!
tc_.waitToExit()) {
69 bool max_drops =
false;
70 if (
options_.getMaxDrop().size() > 0) {
72 static_cast<uint64_t
>(
options_.getMaxDrop()[0])) {
77 if (
options_.getMaxDrop().size() > 1) {
79 static_cast<uint64_t
>(
options_.getMaxDrop()[1])) {
85 std::cout <<
"Reached maximum drops number." << std::endl;
87 if (!
tc_.waitToExit()) {
93 bool max_pdrops =
false;
94 if (
options_.getMaxDropPercentage().size() > 0) {
104 if (
options_.getMaxDropPercentage().size() > 1) {
108 options_.getMaxDropPercentage()[1]))
115 std::cout <<
"Reached maximum percentage of drops." << std::endl;
117 if (!
tc_.waitToExit()) {
134 if (!
options_.getWrapped().empty()) {
143 uint64_t packets_due =
145 if ((packets_due == 0) &&
options_.testDiags(
'i')) {
151 auto pkt_count =
tc_.consumeReceivedPackets();
156 if (
options_.getRate() < 10000 && packets_due == 0 && pkt_count == 0) {
170 tc_.sendPackets(packets_due);
175 uint64_t renew_packets_due =
188 if (
options_.getReleaseRate() != 0) {
189 uint64_t release_packets_due =
202 if (
options_.getReportDelay() > 0) {
203 tc_.printIntermediateStats();
212 tc_.cleanCachedPackets();
219 if (!
options_.getWrapped().empty()) {
221 tc_.runWrapped(
true);
230 if (
options_.testDiags(
's') &&
tc_.serverIdReceived()) {
231 std::cout <<
"Server id: " <<
tc_.getServerId() << std::endl;
236 std::cout <<
"Interrupted" << std::endl;
241 tc_.printTemplates();
TestControl tc_
Object for controlling sending and receiving packets.
ExchangeType stage2_xchg_
CommandOptions & options_
Reference to commandline options.
ExchangeType stage1_xchg_
RateControl renew_rate_control_
A rate control class for Renew messages.
int run() override
brief\ Run performance test.
bool checkExitConditions()
Check if test exit conditions fulfilled.
RateControl release_rate_control_
A rate control class for Release messages.
RateControl basic_rate_control_
A rate control class for Discover and Solicit messages.
void printLeases() const
Delegate to all exchanges to print their leases.
uint64_t getDroppedPacketsNum(const ExchangeType xchg_type) const
Return total number of dropped packets.
const CustomCounter & incrementCounter(const std::string &counter_key, const uint64_t value=1)
Increment specified counter.
void printTimestamps() const
Print timestamps of all packets.
uint64_t getSentPacketsNum(const ExchangeType xchg_type) const
Return total number of sent packets.
boost::posix_time::time_period getTestPeriod() const
Get time period since the start of test.
bool droppedPackets() const
Check if any packet drops occurred.
Defines the logger used by the top-level component of kea-lfc.