Kea  1.9.9-git
rate_control.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef RATE_CONTROL_H
8 #define RATE_CONTROL_H
9 
10 #include <boost/date_time/posix_time/posix_time.hpp>
11 
12 namespace isc {
13 namespace perfdhcp {
14 
38 class RateControl {
39 public:
40 
42  RateControl();
43 
47  RateControl(const unsigned int rate);
48 
72  uint64_t getOutboundMessageCount(bool const waiting_to_exit = false);
73 
75  unsigned int getRate() const {
76  return (rate_);
77  }
78 
83  void setRate(const int rate);
84 
85 protected:
86 
90  boost::posix_time::ptime currentTime();
91 
93  unsigned int rate_;
94 
96 
100 
102 
105  boost::posix_time::ptime start_time_;
106 };
107 
108 }
109 }
110 
111 #endif
boost::posix_time::ptime currentTime()
Convenience function returning current time.
Definition: rate_control.cc:66
RateControl()
Default constructor.
Definition: rate_control.cc:19
unsigned int rate_
Holds a desired rate value.
Definition: rate_control.h:93
A message sending rate control class for perfdhcp.
Definition: rate_control.h:38
boost::posix_time::ptime start_time_
Holds time of start of testing.
Definition: rate_control.h:105
uint64_t total_pkts_sent_count_
Holds number of packets send from the beginning.
Definition: rate_control.h:99
void setRate(const int rate)
Sets the new rate.
Definition: rate_control.cc:71
Defines the logger used by the top-level component of kea-dhcp-ddns.
unsigned int getRate() const
Returns the rate.
Definition: rate_control.h:75
uint64_t getOutboundMessageCount(bool const waiting_to_exit=false)
Returns number of messages to be sent "now".
Definition: rate_control.cc:28