17using namespace boost::posix_time;
20 : rate_(0), total_pkts_sent_count_(0) {
24 : rate_(rate), total_pkts_sent_count_(0) {
41 if (waiting_to_exit) {
49 time_duration duration = period.length();
50 uint64_t should_sent_pkts_count =
static_cast<double>(
getRate()) /
static_cast<double>(time_duration::ticks_per_second()) * duration.ticks();
57 if (pending_pkts_count > 3) {
58 pending_pkts_count = 3;
62 return pending_pkts_count;
65boost::posix_time::ptime
67 return (microsec_clock::universal_time());
74 <<
", expected non-negative value");
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
boost::posix_time::ptime currentTime()
Convenience function returning current time.
RateControl()
Default constructor.
uint64_t total_pkts_sent_count_
Holds number of packets send from the beginning.
unsigned int getRate() const
Returns the rate.
unsigned int rate_
Holds a desired rate value.
void setRate(const int rate)
Sets the new rate.
uint64_t getOutboundMessageCount(bool const waiting_to_exit=false)
Returns number of messages to be sent "now".
boost::posix_time::ptime start_time_
Holds time of start of testing.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Defines the logger used by the top-level component of kea-lfc.