Add Trace to measure the number of packet retires (for Etx metric)

This commit is contained in:
Tommaso Pecorella
2014-04-18 23:32:55 +02:00
parent a6316eb5a3
commit 9c76f9ff43
2 changed files with 23 additions and 0 deletions

View File

@@ -83,6 +83,9 @@ LrWpanMac::GetTypeId (void)
.AddTraceSource ("MacState",
"The state of LrWpan Mac",
MakeTraceSourceAccessor (&LrWpanMac::m_macStateLogger))
.AddTraceSource ("MacSentPkt",
"Trace source reporting some information about the sent packet",
MakeTraceSourceAccessor (&LrWpanMac::m_sentPktTrace))
;
return tid;
}
@@ -669,6 +672,15 @@ LrWpanMac::RemoveFirstTxQElement (void)
{
TxQueueElement *txQElement = m_txQueue.front ();
Ptr<const Packet> p = txQElement->txQPkt;
Ptr<Packet> pkt = p->Copy ();
LrWpanMacHeader hdr;
pkt->RemoveHeader (hdr);
if (hdr.GetShortDstAddr () != Mac16Address ("ff:ff"))
{
m_sentPktTrace (p, m_retransmission+1, 0);
}
txQElement->txQPkt = 0;
delete txQElement;
m_txQueue.pop_front ();

View File

@@ -312,6 +312,17 @@ private:
bool PrepareRetransmission (void);
void CheckQueue (void);
/**
* The trace source fired when packets are considered as successfully sent
* or the transmission has been given up.
* Only non-broadcast packets are traced.
*
* The data should represent:
* packet, number of retries, total number of csma backoffs (not currently implemented)
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet>, uint8_t, uint8_t > m_sentPktTrace;
TracedCallback<Ptr<const Packet>, bool> m_macTxQueueTrace;
/**