--- a/src/lr-wpan/model/lr-wpan-csmaca.cc Sat Apr 26 22:21:13 2014 -0700
+++ b/src/lr-wpan/model/lr-wpan-csmaca.cc Fri Apr 25 23:46:03 2014 +0200
@@ -378,4 +378,10 @@
return 1;
}
+uint8_t
+LrWpanCsmaCa::GetNB (void)
+{
+ return m_NB;
+}
+
} //namespace ns3
--- a/src/lr-wpan/model/lr-wpan-csmaca.h Sat Apr 26 22:21:13 2014 -0700
+++ b/src/lr-wpan/model/lr-wpan-csmaca.h Fri Apr 25 23:46:03 2014 +0200
@@ -231,6 +231,13 @@
*/
int64_t AssignStreams (int64_t stream);
+ /**
+ * Get the number of CSMA retries
+ *
+ * \returns the number of CSMA retries
+ */
+ uint8_t GetNB (void);
+
private:
virtual void DoDispose (void);
--- a/src/lr-wpan/model/lr-wpan-mac.cc Sat Apr 26 22:21:13 2014 -0700
+++ b/src/lr-wpan/model/lr-wpan-mac.cc Fri Apr 25 23:46:03 2014 +0200
@@ -106,6 +106,7 @@
m_macPromiscuousMode = false;
m_macMaxFrameRetries = 3;
m_retransmission = 0;
+ m_numCsmacaRetry = 0;
m_txPkt = 0;
Ptr<UniformRandomVariable> uniformVar = CreateObject<UniformRandomVariable> ();
@@ -675,13 +676,14 @@
{
TxQueueElement *txQElement = m_txQueue.front ();
Ptr<const Packet> p = txQElement->txQPkt;
+ m_numCsmacaRetry += m_csmaCa->GetNB () + 1;
Ptr<Packet> pkt = p->Copy ();
LrWpanMacHeader hdr;
pkt->RemoveHeader (hdr);
if (hdr.GetShortDstAddr () != Mac16Address ("ff:ff"))
{
- m_sentPktTrace (p, m_retransmission+1, 0);
+ m_sentPktTrace (p, m_retransmission+1, m_numCsmacaRetry);
}
txQElement->txQPkt = 0;
@@ -689,6 +691,7 @@
m_txQueue.pop_front ();
m_txPkt = 0;
m_retransmission = 0;
+ m_numCsmacaRetry = 0;
m_macTxQueueTrace (p, false);
}
@@ -734,6 +737,7 @@
else
{
m_retransmission++;
+ m_numCsmacaRetry += m_csmaCa->GetNB () +1;
// Start next CCA process for this packet.
return true;
}
--- a/src/lr-wpan/model/lr-wpan-mac.h Sat Apr 26 22:21:13 2014 -0700
+++ b/src/lr-wpan/model/lr-wpan-mac.h Fri Apr 25 23:46:03 2014 +0200
@@ -318,7 +318,7 @@
* Only non-broadcast packets are traced.
*
* The data should represent:
- * packet, number of retries, total number of csma backoffs (not currently implemented)
+ * packet, number of retries, total number of csma backoffs
*
* \see class CallBackTraceSource
*/
@@ -424,6 +424,7 @@
Mac64Address m_selfExt;
std::deque<TxQueueElement*> m_txQueue;
uint8_t m_retransmission;
+ uint8_t m_numCsmacaRetry;
EventId m_ackWaitTimeout;
EventId m_setMacState;
bool m_macRxOnWhenIdle;