diff --git a/src/lte/model/lte-ue-mac.cc b/src/lte/model/lte-ue-mac.cc index 758306e05..6d0531f5d 100644 --- a/src/lte/model/lte-ue-mac.cc +++ b/src/lte/model/lte-ue-mac.cc @@ -235,7 +235,13 @@ LteUeMac::GetTypeId (void) static TypeId tid = TypeId ("ns3::LteUeMac") .SetParent () .SetGroupName("Lte") - .AddConstructor (); + .AddConstructor () + .AddTraceSource ("RaResponseTimeout", + "trace fired upon RA response timeout", + MakeTraceSourceAccessor (&LteUeMac::m_raResponseTimeoutTrace), + "ns3::LteUeMac::RaResponseTimeoutTracedCallback") + + ; return tid; } @@ -498,6 +504,9 @@ LteUeMac::RaResponseTimeout (bool contention) m_waitingForRaResponse = false; // 3GPP 36.321 5.1.4 ++m_preambleTransmissionCounter; + //fire RA response timeout trace + m_raResponseTimeoutTrace (m_imsi, contention, m_preambleTransmissionCounter, + m_rachConfig.preambleTransMax + 1); if (m_preambleTransmissionCounter == m_rachConfig.preambleTransMax + 1) { NS_LOG_INFO ("RAR timeout, preambleTransMax reached => giving up"); diff --git a/src/lte/model/lte-ue-mac.h b/src/lte/model/lte-ue-mac.h index 699ca60b9..6be5f60a2 100644 --- a/src/lte/model/lte-ue-mac.h +++ b/src/lte/model/lte-ue-mac.h @@ -34,6 +34,7 @@ #include #include #include +#include namespace ns3 { @@ -60,6 +61,19 @@ public: virtual ~LteUeMac (); virtual void DoDispose (void); + /** + * \brief TracedCallback signature for RA response timeout events + * exporting IMSI, contention flag, preamble transmission counter + * and the max limit of preamble transmission + * + * \param [in] imsi + * \param [in] contention + * \param [in] preambleTxCounter + * \param [in] maxPreambleTxLimit + */ + typedef void (* RaResponseTimeoutTracedCallback) + (uint64_t imsi, bool contention, uint8_t preambleTxCounter, uint8_t maxPreambleTxLimit); + /** * \brief Get the LTE MAC SAP provider * \return a pointer to the LTE MAC SAP provider @@ -273,6 +287,13 @@ private: uint32_t m_subframeNo; ///< subframe number uint8_t m_raRnti; ///< RA RNTI bool m_waitingForRaResponse; ///< waiting for RA response + + /** + * \brief The `RaResponseTimeout` trace source. Fired RA response timeout. + * Exporting IMSI, contention flag, preamble transmission counter + * and the max limit of preamble transmission. + */ + TracedCallback m_raResponseTimeoutTrace; }; } // namespace ns3