apps+utils: Correcting Interest-Delay tracing
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cc b/apps/ndn-consumer-zipf-mandelbrot.cc
index 645ba11..c0e84d8 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cc
+++ b/apps/ndn-consumer-zipf-mandelbrot.cc
@@ -165,7 +165,13 @@
NS_LOG_DEBUG ("Trying to add " << seq << " with " << Simulator::Now () << ". already " << m_seqTimeouts.size () << " items");
m_seqTimeouts.insert (SeqTimeout (seq, Simulator::Now ()));
- m_seqLifetimes.insert (SeqTimeout (seq, Simulator::Now ()));
+ m_seqFullDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+ m_seqLastDelay.erase (seq);
+ m_seqLastDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+ m_seqRetxCounts[seq] ++;
+
m_transmittedInterests (&interestHeader, this, m_face);
m_rtt->SentSeq (SequenceNumber32 (seq), 1);
diff --git a/apps/ndn-consumer.cc b/apps/ndn-consumer.cc
index e71a5f4..08d4b2c 100644
--- a/apps/ndn-consumer.cc
+++ b/apps/ndn-consumer.cc
@@ -217,7 +217,12 @@
NS_LOG_DEBUG ("Trying to add " << seq << " with " << Simulator::Now () << ". already " << m_seqTimeouts.size () << " items");
m_seqTimeouts.insert (SeqTimeout (seq, Simulator::Now ()));
- m_seqLifetimes.insert (SeqTimeout (seq, Simulator::Now ()));
+ m_seqFullDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+ m_seqLastDelay.erase (seq);
+ m_seqLastDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+ m_seqRetxCounts[seq] ++;
m_transmittedInterests (&interestHeader, this, m_face);
@@ -248,19 +253,22 @@
uint32_t seq = boost::lexical_cast<uint32_t> (contentObject->GetName ().GetComponents ().back ());
NS_LOG_INFO ("< DATA for " << seq);
- SeqTimeoutsContainer::iterator entry = m_seqTimeouts.find (seq);
- if (entry != m_seqTimeouts.end ())
+ SeqTimeoutsContainer::iterator entry = m_seqLastDelay.find (seq);
+ if (entry != m_seqLastDelay.end ())
{
m_lastRetransmittedInterestDataDelay (this, seq, Simulator::Now () - entry->time);
}
- entry = m_seqLifetimes.find (seq);
- if (entry != m_seqLifetimes.end ())
+ entry = m_seqFullDelay.find (seq);
+ if (entry != m_seqFullDelay.end ())
{
- m_firstInterestDataDelay (this, seq, Simulator::Now () - entry->time);
+ m_firstInterestDataDelay (this, seq, Simulator::Now () - entry->time, m_seqRetxCounts[seq]);
}
+
+ m_seqRetxCounts.erase (seq);
+ m_seqFullDelay.erase (seq);
+ m_seqLastDelay.erase (seq);
- m_seqLifetimes.erase (seq);
m_seqTimeouts.erase (seq);
m_retxSeqs.erase (seq);
diff --git a/apps/ndn-consumer.h b/apps/ndn-consumer.h
index 7fd8877..03c3dd9 100644
--- a/apps/ndn-consumer.h
+++ b/apps/ndn-consumer.h
@@ -31,6 +31,7 @@
//#include "ns3/internet-module.h"
#include <set>
+#include <map>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/tag.hpp>
@@ -175,11 +176,14 @@
> { } ;
SeqTimeoutsContainer m_seqTimeouts; ///< \brief multi-index for the set of SeqTimeout structs
- SeqTimeoutsContainer m_seqLifetimes;
+
+ SeqTimeoutsContainer m_seqLastDelay;
+ SeqTimeoutsContainer m_seqFullDelay;
+ std::map<uint32_t, uint32_t> m_seqRetxCounts;
TracedCallback<Ptr<Node>, Ptr<Node>, uint32_t, uint32_t > m_pathWeightsTrace;
TracedCallback<Ptr<App> /* app */, uint32_t /* seqno */, Time /* delay */> m_lastRetransmittedInterestDataDelay;
- TracedCallback<Ptr<App> /* app */, uint32_t /* seqno */, Time /* delay */> m_firstInterestDataDelay;
+ TracedCallback<Ptr<App> /* app */, uint32_t /* seqno */, Time /* delay */, uint32_t /*retx count*/> m_firstInterestDataDelay;
/// @endcond
};
diff --git a/docs/source/metric.rst b/docs/source/metric.rst
index 02c1eea..03ee82f 100644
--- a/docs/source/metric.rst
+++ b/docs/source/metric.rst
@@ -245,6 +245,8 @@
+-----------------+---------------------------------------------------------------------+
| ``DelayUS`` | delay value, specified in microseconds (10^-6) |
+-----------------+---------------------------------------------------------------------+
+ | ``RetxCount`` | number of Interest retransmissions (for LastDelay always equal to 1)|
+ +-----------------+---------------------------------------------------------------------+
.. _app delay trace helper example:
diff --git a/utils/tracers/ndn-app-delay-tracer.cc b/utils/tracers/ndn-app-delay-tracer.cc
index 6ed3e87..b02b3ac 100644
--- a/utils/tracers/ndn-app-delay-tracer.cc
+++ b/utils/tracers/ndn-app-delay-tracer.cc
@@ -128,7 +128,8 @@
<< "Type" << "\t"
<< "DelayS" << "\t"
- << "DelayUS" << "\n";
+ << "DelayUS" << "\t"
+ << "RetxCount" << "";
}
void
@@ -139,18 +140,20 @@
<< seqno << "\t"
<< "LastDelay" << "\t"
<< delay.ToDouble (Time::S) << "\t"
- << delay.ToDouble (Time::US) << "\n";
+ << delay.ToDouble (Time::US) << "\t"
+ << 1 << "\n";
}
void
-AppDelayTracer::FirstInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay)
+AppDelayTracer::FirstInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, uint32_t retxCount)
{
*m_os << m_node << "\t"
<< app->GetId () << "\t"
<< seqno << "\t"
<< "FullDelay" << "\t"
<< delay.ToDouble (Time::S) << "\t"
- << delay.ToDouble (Time::US) << "\n";
+ << delay.ToDouble (Time::US) << "\t"
+ << retxCount << "\n";
}
diff --git a/utils/tracers/ndn-app-delay-tracer.h b/utils/tracers/ndn-app-delay-tracer.h
index af0007f..ac586b2 100644
--- a/utils/tracers/ndn-app-delay-tracer.h
+++ b/utils/tracers/ndn-app-delay-tracer.h
@@ -94,7 +94,7 @@
LastRetransmittedInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay);
void
- FirstInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay);
+ FirstInterestDataDelay (Ptr<App> app, uint32_t seqno, Time delay, uint32_t rextCount);
private:
std::string m_node;