|
@@ -26,7 +26,7 @@ namespace perfdhcp {
|
|
|
/// of the specific type are sent by perfdhcp. Each message type,
|
|
|
/// for which the desired rate can be specified, has a corresponding
|
|
|
/// \c RateControl object. So, the perfdhcp is using up to three objects
|
|
|
-/// of this type in the same time, to control the rate of the following
|
|
|
+/// of this type at the same time, to control the rate of the following
|
|
|
/// messages being sent:
|
|
|
/// - Discover(DHCPv4) or Solicit (DHCPv6)
|
|
|
/// - Renew (DHCPv6) or Request (DHCPv4) to renew leases.
|
|
@@ -34,16 +34,15 @@ namespace perfdhcp {
|
|
|
///
|
|
|
/// The purpose of the RateControl class is to track the due time for
|
|
|
/// sending next message (or bunch of messages) to keep outbound rate
|
|
|
-/// of particular messages on the desired level. The due time is calculated
|
|
|
+/// of particular messages at the desired level. The due time is calculated
|
|
|
/// using the desired rate value and the timestamp when the last message of
|
|
|
/// the particular type has been sent. That puts the responsibility on the
|
|
|
/// \c TestControl class to invoke the \c RateControl::updateSendDue, every
|
|
|
/// time the message is sent.
|
|
|
///
|
|
|
/// The \c RateControl object returns the number of messages to be sent at
|
|
|
-/// the time. Typically the number returned is 0, if perfdhcp shouldn't send
|
|
|
-/// any messages yet, or 1 (sometimes more) if the send due time has been
|
|
|
-/// reached.
|
|
|
+/// the time. The number returned is 0, if perfdhcp shouldn't send any messages
|
|
|
+/// yet, or 1 (sometimes more) if the send due time has been reached.
|
|
|
class RateControl {
|
|
|
public:
|
|
|
|
|
@@ -68,7 +67,7 @@ public:
|
|
|
|
|
|
/// \brief Returns number of messages to be sent "now".
|
|
|
///
|
|
|
- /// This function calculates how many masseges of the given type should
|
|
|
+ /// This function calculates how many messages of the given type should
|
|
|
/// be sent immediately when the call to the function returns, to catch
|
|
|
/// up with the desired message rate.
|
|
|
///
|
|
@@ -77,6 +76,25 @@ public:
|
|
|
/// the due time has been hit, the non-zero number of messages is returned.
|
|
|
/// If the due time hasn't been hit, the number returned is 0.
|
|
|
///
|
|
|
+ /// If the rate is non-zero, the number of messages to be sent is calculated
|
|
|
+ /// as follows:
|
|
|
+ /// \code
|
|
|
+ /// num = duration * rate
|
|
|
+ /// \endcode
|
|
|
+ /// where <b>duration</b> is a time period between the due time to send
|
|
|
+ /// next set of messages and current time. The duration is expressed in
|
|
|
+ /// seconds with the fractional part having 6 or 9 digits (depending on
|
|
|
+ /// the timer resolution). If the calculated value is equal to 0, it is
|
|
|
+ /// rounded to 1, so as at least one message is sent.
|
|
|
+ ///
|
|
|
+ /// The value of aggressivity limits the maximal number of messages to
|
|
|
+ /// be sent one after another. If the number of messages calculated with
|
|
|
+ /// the equation above exceeds the aggressivity, this function will return
|
|
|
+ /// the value equal to aggressivity.
|
|
|
+ ///
|
|
|
+ /// If the rate is not specified (equal to 0), the value calculated by
|
|
|
+ /// this function is equal to aggressivity.
|
|
|
+ ///
|
|
|
/// \return A number of messages to be sent immediately.
|
|
|
uint64_t getOutboundMessageCount();
|
|
|
|
|
@@ -88,7 +106,7 @@ public:
|
|
|
/// \brief Returns the value of the late send flag.
|
|
|
///
|
|
|
/// The flag returned by this function indicates whether the new due time
|
|
|
- /// calculated by the \c RateControl::updateSendDue has been in the past.
|
|
|
+ /// calculated by the \c RateControl::updateSendDue is in the past.
|
|
|
/// This value is used by the \c TestControl object to increment the counter
|
|
|
/// of the late sent messages in the \c StatsMgr.
|
|
|
bool isLateSent() const {
|
|
@@ -97,17 +115,16 @@ public:
|
|
|
|
|
|
/// \brief Sets the value of aggressivity.
|
|
|
///
|
|
|
- /// \param aggressivity A new value of aggressivity.
|
|
|
- void setAggressivity(const int aggressivity) {
|
|
|
- aggressivity_ = aggressivity;
|
|
|
- }
|
|
|
+ /// \param aggressivity A new value of aggressivity. This value must be
|
|
|
+ /// a positive integer.
|
|
|
+ /// \throw isc::BadValue if new value is not a positive integer.
|
|
|
+ void setAggressivity(const int aggressivity);
|
|
|
|
|
|
/// \brief Sets the new rate.
|
|
|
///
|
|
|
- /// \param rate A new value of rate.
|
|
|
- void setRate(const int rate) {
|
|
|
- rate_ = rate;
|
|
|
- }
|
|
|
+ /// \param rate A new value of rate. This value must not be negative.
|
|
|
+ /// \throw isc::BadValue if new rate is negative.
|
|
|
+ void setRate(const int rate);
|
|
|
|
|
|
/// \brief Sets the value of the due time.
|
|
|
///
|