traffic-control: (fixes #2940) QueueDisc SojournTime should be TracedCallback
TracedCallback is invoked for all sojourn time results; TracedValue only for results that changed value from last time
This commit is contained in:
@@ -93,6 +93,7 @@ or with a string value with 'b' (bytes) or 'p' (packets) suffix, such as:
|
||||
<li>QueueDisc::DequeuePeeked has been merged into QueueDisc::Dequeue and hence no longer exists.</li>
|
||||
<li>The QueueDisc base class now provides a default implementation of the DoPeek private method
|
||||
based on the QueueDisc::PeekDequeue method, which is now no longer available.</li>
|
||||
<li>The QueueDisc::SojournTime trace source is changed from a TracedValue to a TracedCallback; callbacks that hook this trace must provide one ns3::Time argument, not two.</li>
|
||||
</ul>
|
||||
<h2>Changes to build system:</h2>
|
||||
<ul>
|
||||
|
||||
@@ -79,9 +79,9 @@ DevicePacketsInQueueTrace (uint32_t oldValue, uint32_t newValue)
|
||||
}
|
||||
|
||||
void
|
||||
SojournTimeTrace (Time oldValue, Time newValue)
|
||||
SojournTimeTrace (Time sojournTime)
|
||||
{
|
||||
std::cout << "Sojourn time " << newValue.ToDouble (Time::MS) << "ms" << std::endl;
|
||||
std::cout << "Sojourn time " << sojournTime.ToDouble (Time::MS) << "ms" << std::endl;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -317,7 +317,7 @@ TypeId QueueDisc::GetTypeId (void)
|
||||
.AddTraceSource ("SojournTime",
|
||||
"Sojourn time of the last packet dequeued from the queue disc",
|
||||
MakeTraceSourceAccessor (&QueueDisc::m_sojourn),
|
||||
"ns3::TracedValueCallback::Time")
|
||||
"ns3::Time::TracedCallback")
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -325,7 +325,6 @@ TypeId QueueDisc::GetTypeId (void)
|
||||
QueueDisc::QueueDisc (QueueDiscSizePolicy policy)
|
||||
: m_nPackets (0),
|
||||
m_nBytes (0),
|
||||
m_sojourn (0),
|
||||
m_maxSize (QueueSize ("1p")), // to avoid that setting the mode at construction time is ignored
|
||||
m_running (false),
|
||||
m_peeked (false),
|
||||
@@ -702,7 +701,7 @@ QueueDisc::PacketDequeued (Ptr<const QueueDiscItem> item)
|
||||
m_stats.nTotalDequeuedPackets++;
|
||||
m_stats.nTotalDequeuedBytes += item->GetSize ();
|
||||
|
||||
m_sojourn = Simulator::Now () - item->GetTimeStamp ();
|
||||
m_sojourn (Simulator::Now () - item->GetTimeStamp ());
|
||||
|
||||
NS_LOG_LOGIC ("m_traceDequeue (p)");
|
||||
m_traceDequeue (item);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/traced-value.h"
|
||||
#include "ns3/traced-callback.h"
|
||||
#include "ns3/net-device.h"
|
||||
#include "ns3/queue-item.h"
|
||||
#include "ns3/queue-size.h"
|
||||
@@ -665,7 +666,7 @@ private:
|
||||
|
||||
TracedValue<uint32_t> m_nPackets; //!< Number of packets in the queue
|
||||
TracedValue<uint32_t> m_nBytes; //!< Number of bytes in the queue
|
||||
TracedValue<Time> m_sojourn; //!< Sojourn time of the latest dequeued packet
|
||||
TracedCallback<Time> m_sojourn; //!< Sojourn time of the latest dequeued packet
|
||||
QueueSize m_maxSize; //!< max queue size
|
||||
|
||||
Stats m_stats; //!< The collected statistics
|
||||
|
||||
Reference in New Issue
Block a user