Enabling trace sources for Interest-Data lifetimes
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cc b/apps/ndn-consumer-zipf-mandelbrot.cc
index 1fc8d45..645ba11 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cc
+++ b/apps/ndn-consumer-zipf-mandelbrot.cc
@@ -165,7 +165,7 @@
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_interestLifeTime)); // only one insert will work. if entry exists, nothing will happen... nothing should happen
+ m_seqLifetimes.insert (SeqTimeout (seq, Simulator::Now ()));
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 c889b6d..794bcb9 100644
--- a/apps/ndn-consumer.cc
+++ b/apps/ndn-consumer.cc
@@ -78,6 +78,12 @@
.AddTraceSource ("PathWeightsTrace", "PathWeightsTrace",
MakeTraceSourceAccessor (&Consumer::m_pathWeightsTrace))
+
+ .AddTraceSource ("LastRetransmittedInterestDataDelay", "Delay between last retransmitted Interest and received Data",
+ MakeTraceSourceAccessor (&Consumer::m_lastRetransmittedInterestDataDelay))
+
+ .AddTraceSource ("FirstInterestDataDelay", "Delay between first transmitted Interest and received Data",
+ MakeTraceSourceAccessor (&Consumer::m_firstInterestDataDelay))
;
return tid;
@@ -172,21 +178,10 @@
uint32_t seq=std::numeric_limits<uint32_t>::max (); //invalid
- // std::cout << Simulator::Now ().ToDouble (Time::S) << "s max -> " << m_seqMax << "\n";
-
while (m_retxSeqs.size ())
{
seq = *m_retxSeqs.begin ();
m_retxSeqs.erase (m_retxSeqs.begin ());
-
- // NS_ASSERT (m_seqLifetimes.find (seq) != m_seqLifetimes.end ());
- // if (m_seqLifetimes.find (seq)->time <= Simulator::Now ())
- // {
-
- // NS_LOG_DEBUG ("Expire " << seq);
- // m_seqLifetimes.erase (seq); // lifetime expired. Trying to find another unexpired sequence number
- // continue;
- // }
break;
}
@@ -203,8 +198,6 @@
seq = m_seq++;
}
- // std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << seq << "\n";
-
//
Ptr<NameComponents> nameWithSequence = Create<NameComponents> (m_interestName);
(*nameWithSequence) (seq);
@@ -224,7 +217,8 @@
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_interestLifeTime)); // only one insert will work. if entry exists, nothing will happen... nothing should happen
+ m_seqLifetimes.insert (SeqTimeout (seq, Simulator::Now ()));
+
m_transmittedInterests (&interestHeader, this, m_face);
m_rtt->SentSeq (SequenceNumber32 (seq), 1);
@@ -254,14 +248,26 @@
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);
+ SeqTimeoutsContainer::iterator entry = m_seqTimeouts.find (seq);
+ if (entry != m_seqTimeouts.end ())
+ {
+ m_lastRetransmittedInterestDataDelay (this, seq, Simulator::Now () - entry->time);
+ }
+ else
+ {
+ NS_ASSERT_MSG (entry != m_seqTimeouts.end (), "Something is now right");
+ }
- // NS_ASSERT_MSG (entry != m_seqTimeouts.end (),
- // "Comment out this assert, if it causes problems");
-
- // if (entry != m_seqTimeouts.end ())
- // m_seqTimeouts.erase (entry);
-
+ entry = m_seqLifetimes.find (seq);
+ if (entry != m_seqLifetimes.end ())
+ {
+ m_firstInterestDataDelay (this, seq, Simulator::Now () - entry->time);
+ }
+ else
+ {
+ NS_ASSERT_MSG (entry != m_seqLifetimes.end (), "Something is now right");
+ }
+
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 e9f9a74..7fd8877 100644
--- a/apps/ndn-consumer.h
+++ b/apps/ndn-consumer.h
@@ -178,6 +178,9 @@
SeqTimeoutsContainer m_seqLifetimes;
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;
+
/// @endcond
};