A Discrete-Event Network Simulator
API
dynamic-queue-limits.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Pasquale Imputato <p.imputato@gmail.com>
18  * Stefano Avallone <stefano.avallone@unina.it>
19  *
20  * This code is a port of the dynamic queue limits library implemented
21  * in the Linux kernel by
22  * Author: Tom Herbert <therbert@google.com>
23  */
24 
25 #ifndef DYNAMIC_QUEUE_LIMITS_H
26 #define DYNAMIC_QUEUE_LIMITS_H
27 
28 #include "queue-limits.h"
29 
30 #include "ns3/nstime.h"
31 #include "ns3/traced-value.h"
32 
33 #include <limits.h>
34 
35 namespace ns3
36 {
37 
66 {
67  public:
72  static TypeId GetTypeId();
73 
75  ~DynamicQueueLimits() override;
76 
77  void Reset() override;
78  void Completed(uint32_t count) override;
79  int32_t Available() const override;
80  void Queued(uint32_t count) override;
81 
82  private:
90  int32_t Posdiff(int32_t a, int32_t b);
91 
92  // Fields accessed in enqueue path
93  uint32_t m_numQueued{0};
94  uint32_t m_adjLimit{0};
95  uint32_t m_lastObjCnt{0};
96 
97  // Fields accessed only by completion path
99  uint32_t m_numCompleted{0};
100 
101  uint32_t m_prevOvlimit{0};
102  uint32_t m_prevNumQueued{0};
103  uint32_t m_prevLastObjCnt{0};
104 
107 
108  // Configuration
109  uint32_t m_maxLimit;
110  uint32_t m_minLimit;
112 };
113 
114 } // namespace ns3
115 
116 #endif /* DYNAMIC_QUEUE_LIMITS_H */
#define max(a, b)
Definition: 80211b.c:42
DynamicQueueLimits would be used in conjunction with a producer/consumer type queue (possibly a netde...
uint32_t m_adjLimit
limit + num_completed
void Reset() override
Reset queue limits state.
uint32_t m_numCompleted
Total ever completed.
Time m_slackStartTime
Time slacks seen.
uint32_t m_numQueued
Total ever queued.
uint32_t m_prevOvlimit
Previous over limit.
uint32_t m_minLimit
Minimum limit.
Time m_slackHoldTime
Time to measure slack.
uint32_t m_prevNumQueued
Previous queue total.
uint32_t m_lastObjCnt
Count at last queuing.
uint32_t m_prevLastObjCnt
Previous queuing cnt.
static TypeId GetTypeId()
Get the type ID.
void Completed(uint32_t count) override
Record number of completed bytes and recalculate the limit.
int32_t Posdiff(int32_t a, int32_t b)
Calculates the difference between the two operators and returns the number if positive,...
uint32_t m_lowestSlack
Lowest slack found.
int32_t Available() const override
Available is called from NotifyTransmittedBytes to calculate the number of bytes that can be passed a...
TracedValue< uint32_t > m_limit
Current limit.
void Queued(uint32_t count) override
Record the number of bytes queued.
uint32_t m_maxLimit
Max limit.
Abstract base class for NetDevice queue length controller.
Definition: queue-limits.h:44
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Every class exported by the ns3 library is enclosed in the ns3 namespace.