Fix bug PDCP stats
authorManuel Requena <manuel.requena@cttc.es>
Tue, 29 Nov 2011 14:10:48 +0100
changeset 8420 87a8a13f0cbb
parent 8411 5794513367a1
child 8421 9b142396238a
Fix bug PDCP stats
src/lte/model/lte-pdcp.cc
--- a/src/lte/model/lte-pdcp.cc	Fri Nov 25 17:07:42 2011 +0100
+++ b/src/lte/model/lte-pdcp.cc	Tue Nov 29 14:10:48 2011 +0100
@@ -163,15 +163,16 @@
   NS_LOG_LOGIC ("PDCP header: " << pdcpHeader);
   p->AddHeader (pdcpHeader);
 
+  // Sender timestamp
   PdcpTag pdcpTag (Simulator::Now ());
-  p->AddPacketTag (pdcpTag);
+  p->AddByteTag (pdcpTag);
+  m_txPdu (m_rnti, m_lcid, p->GetSize ());
 
   LteRlcSapProvider::TransmitPdcpPduParameters params;
   params.rnti = m_rnti;
   params.lcid = m_lcid;
   params.pdcpPdu = p;
 
-  m_txPdu (m_rnti, m_lcid, p->GetSize ());
   m_rlcSapProvider->TransmitPdcpPdu (params);
 }
 
@@ -180,33 +181,30 @@
 {
   NS_LOG_FUNCTION (this);
 
+  // Receiver timestamp
+  PdcpTag pdcpTag;
+  Time delay;
+  if (p->FindFirstMatchingByteTag (pdcpTag))
+    {
+      delay = Simulator::Now() - pdcpTag.GetSenderTimestamp ();
+    }
+  m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());
+
   LtePdcpHeader pdcpHeader;
   p->RemoveHeader (pdcpHeader);
   NS_LOG_LOGIC ("PDCP header: " << pdcpHeader);
 
-  PdcpTag pdcpTag;
-  Time delay;
-  if (p->FindFirstMatchingByteTag(pdcpTag))
-    {
-      delay = Simulator::Now() - pdcpTag.GetSenderTimestamp ();
-    }
-  else
-    {
-      NS_LOG_WARN (this << " could not find PdcpTag");
-    }
-
   m_rxSequenceNumber = pdcpHeader.GetSequenceNumber () + 1;
   if (m_rxSequenceNumber > m_maxPdcpSn)
     {
       m_rxSequenceNumber = 0;
     }
-  m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());
+
   LtePdcpSapUser::ReceiveRrcPduParameters params;
   params.rrcPdu = p;
   params.rnti = m_rnti;
   params.lcid = m_lcid;
   m_pdcpSapUser->ReceiveRrcPdu (params);
-
 }
 
 void