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