convert TRACE to NS_LOG
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
#include "ns3/assert.h"
|
||||
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
#include "dca-txop.h"
|
||||
#include "dcf.h"
|
||||
@@ -30,19 +30,9 @@
|
||||
#include "mac-tx-middle.h"
|
||||
#include "wifi-phy.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("DcaTxop");
|
||||
|
||||
|
||||
#define noDCA_TXOP_TRACE 1
|
||||
|
||||
#ifdef DCA_TXOP_TRACE
|
||||
#include "ns3/simulator.h"
|
||||
#include <iostream>
|
||||
# define TRACE(x) \
|
||||
std::cout <<"DCA TXOP now="<<Simulator::NowUs ()<<"us "<<x<<std::endl;
|
||||
#else /* DCA_TXOP_TRACE */
|
||||
# define TRACE(x)
|
||||
#endif /* DCA_TXOP_TRACE */
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class DcaTxop::NavListener : public ns3::MacLowNavListener {
|
||||
@@ -372,12 +362,12 @@ DcaTxop::AccessNeeded (void)
|
||||
if (!m_queue->IsEmpty () ||
|
||||
m_hasCurrent)
|
||||
{
|
||||
TRACE ("access needed here");
|
||||
NS_LOG_DEBUG ("access needed here");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE ("no access needed here");
|
||||
NS_LOG_DEBUG ("no access needed here");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -389,7 +379,7 @@ DcaTxop::AccessGrantedNow (void)
|
||||
{
|
||||
if (m_queue->IsEmpty ())
|
||||
{
|
||||
TRACE ("queue empty");
|
||||
NS_LOG_DEBUG ("queue empty");
|
||||
return;
|
||||
}
|
||||
bool found;
|
||||
@@ -404,7 +394,7 @@ DcaTxop::AccessGrantedNow (void)
|
||||
m_ssrc = 0;
|
||||
m_slrc = 0;
|
||||
m_fragmentNumber = 0;
|
||||
TRACE ("dequeued size="<<m_currentPacket.GetSize ()<<
|
||||
NS_LOG_DEBUG ("dequeued size="<<m_currentPacket.GetSize ()<<
|
||||
", to="<<m_currentHdr.GetAddr1 ()<<
|
||||
", seq="<<m_currentHdr.GetSequenceControl ());
|
||||
}
|
||||
@@ -422,7 +412,7 @@ DcaTxop::AccessGrantedNow (void)
|
||||
m_hasCurrent = false;
|
||||
m_dcf->ResetCw ();
|
||||
m_dcf->StartBackoff ();
|
||||
TRACE ("tx broadcast");
|
||||
NS_LOG_DEBUG ("tx broadcast");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -435,12 +425,12 @@ DcaTxop::AccessGrantedNow (void)
|
||||
Packet fragment = GetFragmentPacket (&hdr);
|
||||
if (IsLastFragment ())
|
||||
{
|
||||
TRACE ("fragmenting last fragment size="<<fragment->GetSize ());
|
||||
NS_LOG_DEBUG ("fragmenting last fragment size="<<fragment.GetSize ());
|
||||
params.DisableNextData ();
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE ("fragmenting size="<<fragment->GetSize ());
|
||||
NS_LOG_DEBUG ("fragmenting size="<<fragment.GetSize ());
|
||||
params.EnableNextData (GetNextFragmentSize ());
|
||||
}
|
||||
Low ()->StartTransmission (fragment, &hdr, params,
|
||||
@@ -451,12 +441,12 @@ DcaTxop::AccessGrantedNow (void)
|
||||
if (NeedRts ())
|
||||
{
|
||||
params.EnableRts ();
|
||||
TRACE ("tx unicast rts");
|
||||
NS_LOG_DEBUG ("tx unicast rts");
|
||||
}
|
||||
else
|
||||
{
|
||||
params.DisableRts ();
|
||||
TRACE ("tx unicast");
|
||||
NS_LOG_DEBUG ("tx unicast");
|
||||
}
|
||||
params.DisableNextData ();
|
||||
// We need to make a copy in case we need to
|
||||
@@ -476,13 +466,13 @@ DcaTxop::AccessGrantedNow (void)
|
||||
void
|
||||
DcaTxop::GotCts (double snr, WifiMode txMode)
|
||||
{
|
||||
TRACE ("got cts");
|
||||
NS_LOG_DEBUG ("got cts");
|
||||
m_ssrc = 0;
|
||||
}
|
||||
void
|
||||
DcaTxop::MissedCts (void)
|
||||
{
|
||||
TRACE ("missed cts");
|
||||
NS_LOG_DEBUG ("missed cts");
|
||||
m_ssrc++;
|
||||
m_ctstimeoutTrace (m_ssrc);
|
||||
if (m_ssrc > Parameters ()->GetMaxSsrc ())
|
||||
@@ -505,7 +495,7 @@ DcaTxop::GotAck (double snr, WifiMode txMode)
|
||||
if (!NeedFragmentation () ||
|
||||
IsLastFragment ())
|
||||
{
|
||||
TRACE ("got ack. tx done.");
|
||||
NS_LOG_DEBUG ("got ack. tx done.");
|
||||
if (!m_txOkCallback.IsNull ())
|
||||
{
|
||||
m_txOkCallback (m_currentHdr);
|
||||
@@ -520,13 +510,13 @@ DcaTxop::GotAck (double snr, WifiMode txMode)
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE ("got ack. tx not done, size="<<m_currentPacket.GetSize ());
|
||||
NS_LOG_DEBUG ("got ack. tx not done, size="<<m_currentPacket.GetSize ());
|
||||
}
|
||||
}
|
||||
void
|
||||
DcaTxop::MissedAck (void)
|
||||
{
|
||||
TRACE ("missed ack");
|
||||
NS_LOG_DEBUG ("missed ack");
|
||||
m_slrc++;
|
||||
m_acktimeoutTrace (m_slrc);
|
||||
if (m_slrc > Parameters ()->GetMaxSlrc ())
|
||||
@@ -552,7 +542,7 @@ DcaTxop::MissedAck (void)
|
||||
void
|
||||
DcaTxop::StartNext (void)
|
||||
{
|
||||
TRACE ("start next packet fragment");
|
||||
NS_LOG_DEBUG ("start next packet fragment");
|
||||
/* this callback is used only for fragments. */
|
||||
NextFragment ();
|
||||
WifiMacHeader hdr;
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
*/
|
||||
|
||||
#include "ns3/assert.h"
|
||||
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/tag.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
#include "mac-low.h"
|
||||
#include "wifi-phy.h"
|
||||
@@ -31,15 +31,7 @@
|
||||
#include "mac-stations.h"
|
||||
#include "mac-parameters.h"
|
||||
|
||||
#define noMAC_LOW_TRACE 1
|
||||
|
||||
#ifdef MAC_LOW_TRACE
|
||||
# include <iostream>
|
||||
# define TRACE(x) \
|
||||
std::cout << "MAC LOW " << x << std::endl;
|
||||
#else /* MAC_LOW_TRACE */
|
||||
# define TRACE(x)
|
||||
#endif /* MAC_LOW_TRACE */
|
||||
NS_LOG_COMPONENT_DEFINE ("MacLow");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -367,7 +359,7 @@ MacLow::StartTransmission (Packet packet,
|
||||
|
||||
//NS_ASSERT (m_phy->IsStateIdle ());
|
||||
|
||||
TRACE ("startTx size="<< GetCurrentSize () << ", to=" << m_currentHdr.GetAddr1());
|
||||
NS_LOG_DEBUG ("startTx size="<< GetCurrentSize () << ", to=" << m_currentHdr.GetAddr1());
|
||||
|
||||
if (m_txParams.MustSendRts ())
|
||||
{
|
||||
@@ -385,7 +377,7 @@ MacLow::StartTransmission (Packet packet,
|
||||
void
|
||||
MacLow::ReceiveError (Packet packet, double rxSnr)
|
||||
{
|
||||
TRACE ("rx failed ");
|
||||
NS_LOG_DEBUG ("rx failed ");
|
||||
m_dropError (packet);
|
||||
if (m_txParams.MustWaitFastAck ())
|
||||
{
|
||||
@@ -408,7 +400,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
packet.RemoveHeader (hdr);
|
||||
|
||||
bool isPrevNavZero = IsNavZero (Simulator::Now ());
|
||||
TRACE ("duration/id=" << hdr.GetDuration ());
|
||||
NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
|
||||
NotifyNav (Simulator::Now (), &hdr);
|
||||
if (hdr.IsRts ())
|
||||
{
|
||||
@@ -416,7 +408,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
if (isPrevNavZero &&
|
||||
hdr.GetAddr1 () == m_device->GetSelfAddress ())
|
||||
{
|
||||
TRACE ("rx RTS from=" << hdr.GetAddr2 () << ", schedule CTS");
|
||||
NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", schedule CTS");
|
||||
NS_ASSERT (m_sendCtsEvent.IsExpired ());
|
||||
MacStation *station = m_stations->Lookup (hdr.GetAddr2 ());
|
||||
station->ReportRxOk (rxSnr, txMode);
|
||||
@@ -431,7 +423,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE ("rx RTS from=" << hdr.GetAddr2 () << ", cannot schedule CTS");
|
||||
NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", cannot schedule CTS");
|
||||
}
|
||||
}
|
||||
else if (hdr.IsCts () &&
|
||||
@@ -439,7 +431,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
m_ctsTimeoutEvent.IsRunning () &&
|
||||
m_hasCurrent)
|
||||
{
|
||||
TRACE ("receive cts from="<<m_currentHdr.GetAddr1 ());
|
||||
NS_LOG_DEBUG ("receive cts from="<<m_currentHdr.GetAddr1 ());
|
||||
SnrTag tag;
|
||||
packet.PeekTag (tag);
|
||||
MacStation *station = GetStation (m_currentHdr.GetAddr1 ());
|
||||
@@ -462,7 +454,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
m_superFastAckTimeoutEvent.IsRunning ()) &&
|
||||
m_txParams.MustWaitAck ())
|
||||
{
|
||||
TRACE ("receive ack from="<<m_currentHdr.GetAddr1 ());
|
||||
NS_LOG_DEBUG ("receive ack from="<<m_currentHdr.GetAddr1 ());
|
||||
SnrTag tag;
|
||||
packet.PeekTag (tag);
|
||||
MacStation *station = GetStation (m_currentHdr.GetAddr1 ());
|
||||
@@ -493,7 +485,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
}
|
||||
else if (hdr.IsCtl ())
|
||||
{
|
||||
TRACE ("rx drop " << hdr.GetTypeString ());
|
||||
NS_LOG_DEBUG ("rx drop " << hdr.GetTypeString ());
|
||||
}
|
||||
else if (hdr.GetAddr1 () == m_device->GetSelfAddress ())
|
||||
{
|
||||
@@ -502,11 +494,11 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
|
||||
if (hdr.IsQosData () && hdr.IsQosNoAck ())
|
||||
{
|
||||
TRACE ("rx unicast/noAck from="<<hdr.GetAddr2 ());
|
||||
NS_LOG_DEBUG ("rx unicast/noAck from="<<hdr.GetAddr2 ());
|
||||
}
|
||||
else if (hdr.IsData () || hdr.IsMgt ())
|
||||
{
|
||||
TRACE ("rx unicast/sendAck from=" << hdr.GetAddr2 ());
|
||||
NS_LOG_DEBUG ("rx unicast/sendAck from=" << hdr.GetAddr2 ());
|
||||
NS_ASSERT (m_sendAckEvent.IsExpired ());
|
||||
m_sendAckEvent = Simulator::Schedule (GetSifs (),
|
||||
&MacLow::SendAckAfterData, this,
|
||||
@@ -521,7 +513,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
{
|
||||
if (hdr.IsData () || hdr.IsMgt ())
|
||||
{
|
||||
TRACE ("rx broadcast from=" << hdr.GetAddr2 ());
|
||||
NS_LOG_DEBUG ("rx broadcast from=" << hdr.GetAddr2 ());
|
||||
goto rxPacket;
|
||||
}
|
||||
else
|
||||
@@ -531,7 +523,7 @@ MacLow::ReceiveOk (Packet packet, double rxSnr, WifiMode txMode, WifiPreamble pr
|
||||
}
|
||||
else
|
||||
{
|
||||
//TRACE_VERBOSE ("rx not-for-me from %d", GetSource (packet));
|
||||
//NS_LOG_DEBUG_VERBOSE ("rx not-for-me from %d", GetSource (packet));
|
||||
}
|
||||
return;
|
||||
rxPacket:
|
||||
@@ -738,7 +730,7 @@ MacLow::FastAckTimeout (void)
|
||||
station->ReportDataFailed ();
|
||||
if (m_phy->IsStateIdle ())
|
||||
{
|
||||
TRACE ("fast Ack idle missed");
|
||||
NS_LOG_DEBUG ("fast Ack idle missed");
|
||||
m_listener->MissedAck ();
|
||||
}
|
||||
m_listener = 0;
|
||||
@@ -750,12 +742,12 @@ MacLow::SuperFastAckTimeout ()
|
||||
station->ReportDataFailed ();
|
||||
if (m_phy->IsStateIdle ())
|
||||
{
|
||||
TRACE ("super fast Ack failed");
|
||||
NS_LOG_DEBUG ("super fast Ack failed");
|
||||
m_listener->MissedAck ();
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE ("super fast Ack ok");
|
||||
NS_LOG_DEBUG ("super fast Ack ok");
|
||||
m_listener->GotAck (0.0, WifiMode ());
|
||||
}
|
||||
m_listener = 0;
|
||||
@@ -791,7 +783,7 @@ MacLow::SendRtsForPacket (void)
|
||||
}
|
||||
rts.SetDurationUs (duration.GetMicroSeconds ());
|
||||
|
||||
TRACE ("tx RTS to="<< rts.GetAddr1 () << ", mode=" << (uint32_t)rtsTxMode);
|
||||
NS_LOG_DEBUG ("tx RTS to="<< rts.GetAddr1 () << ", mode=" << rtsTxMode.GetPhyRate ());
|
||||
|
||||
Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxMode, WIFI_PREAMBLE_LONG);
|
||||
Time timerDelay = txDuration + GetCtsTimeout ();
|
||||
@@ -851,7 +843,7 @@ MacLow::SendDataPacket (void)
|
||||
StartDataTxTimers ();
|
||||
|
||||
WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
|
||||
TRACE ("tx "<< m_currentHdr.GetTypeString () <<
|
||||
NS_LOG_DEBUG ("tx "<< m_currentHdr.GetTypeString () <<
|
||||
", to=" << m_currentHdr.GetAddr1 () <<
|
||||
", mode=" << dataTxMode.GetPhyRate ());
|
||||
Time duration = Seconds (0);
|
||||
@@ -915,7 +907,7 @@ MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, do
|
||||
/* send a CTS when you receive a RTS
|
||||
* right after SIFS.
|
||||
*/
|
||||
TRACE ("tx CTS to=" << source << ", mode=" << (uint32_t)txMode);
|
||||
NS_LOG_DEBUG ("tx CTS to=" << source << ", mode=" << txMode.GetPhyRate ());
|
||||
WifiMacHeader cts;
|
||||
cts.SetType (WIFI_MAC_CTL_CTS);
|
||||
cts.SetDsNotFrom ();
|
||||
@@ -946,7 +938,7 @@ MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode)
|
||||
NS_ASSERT (m_hasCurrent);
|
||||
WifiMode dataTxMode = GetDataTxMode (m_currentHdr.GetAddr1 (), GetCurrentSize ());
|
||||
|
||||
TRACE ("tx " << m_currentHdr.GetTypeString () << " to=" << m_currentHdr.GetAddr2 () <<
|
||||
NS_LOG_DEBUG ("tx " << m_currentHdr.GetTypeString () << " to=" << m_currentHdr.GetAddr2 () <<
|
||||
", mode=" << dataTxMode.GetPhyRate () << ", seq=0x"<< m_currentHdr.GetSequenceControl ());
|
||||
|
||||
StartDataTxTimers ();
|
||||
@@ -973,7 +965,7 @@ void
|
||||
MacLow::FastAckFailedTimeout (void)
|
||||
{
|
||||
m_listener->MissedAck ();
|
||||
TRACE ("fast Ack busy but missed");
|
||||
NS_LOG_DEBUG ("fast Ack busy but missed");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -982,7 +974,7 @@ MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, d
|
||||
/* send an ACK when you receive
|
||||
* a packet after SIFS.
|
||||
*/
|
||||
TRACE ("tx ACK to=" << source << ", mode=" << txMode.GetPhyRate ());
|
||||
NS_LOG_DEBUG ("tx ACK to=" << source << ", mode=" << txMode.GetPhyRate ());
|
||||
WifiMacHeader ack;
|
||||
ack.SetType (WIFI_MAC_CTL_ACK);
|
||||
ack.SetDsNotFrom ();
|
||||
|
||||
@@ -27,38 +27,11 @@
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/random-variable.h"
|
||||
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/log.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#define nopePHY80211_DEBUG 1
|
||||
#define nopePHY80211_STATE_DEBUG 1
|
||||
|
||||
/* All the state transitions are marked by these macros. */
|
||||
#ifdef PHY80211_STATE_DEBUG
|
||||
#include <iostream>
|
||||
# define STATE_FROM(from) \
|
||||
std::cout << "PHY self=" << this << " old=" << StateToString (from);
|
||||
# define STATE_TO(to) \
|
||||
std::cout << " new=" << StateToString (to);
|
||||
# define STATE_AT(at) \
|
||||
std::cout << " at=" << at << std::endl;
|
||||
#else
|
||||
# define STATE_FROM(from)
|
||||
# define STATE_TO(from)
|
||||
# define STATE_AT(at)
|
||||
#endif
|
||||
|
||||
#ifdef PHY80211_DEBUG
|
||||
#include <iostream>
|
||||
# define TRACE(x) \
|
||||
std::cout << "PHY80211 TRACE " << Simulator::Now ().GetSeconds () << " " << x << std::endl;
|
||||
#else
|
||||
# define TRACE(x)
|
||||
#endif
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("WifiPhy");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -265,16 +238,16 @@ WifiPhy::ReceivePacket (Packet const packet,
|
||||
|
||||
switch (GetState ()) {
|
||||
case WifiPhy::SYNC:
|
||||
TRACE ("drop packet because already in Sync (power="<<
|
||||
rxPowerW<<"W)");
|
||||
NS_LOG_DEBUG ("drop packet because already in Sync (power="<<
|
||||
rxPowerW<<"W)");
|
||||
if (endRx > m_endSync)
|
||||
{
|
||||
goto maybeCcaBusy;
|
||||
}
|
||||
break;
|
||||
case WifiPhy::TX:
|
||||
TRACE ("drop packet because already in Tx (power="<<
|
||||
rxPowerW<<"W)");
|
||||
NS_LOG_DEBUG ("drop packet because already in Tx (power="<<
|
||||
rxPowerW<<"W)");
|
||||
if (endRx > m_endTx)
|
||||
{
|
||||
goto maybeCcaBusy;
|
||||
@@ -295,8 +268,8 @@ WifiPhy::ReceivePacket (Packet const packet,
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE ("drop packet because signal power too Small ("<<
|
||||
rxPowerW<<"<"<<m_edThresholdW<<")");
|
||||
NS_LOG_DEBUG ("drop packet because signal power too Small ("<<
|
||||
rxPowerW<<"<"<<m_edThresholdW<<")");
|
||||
goto maybeCcaBusy;
|
||||
}
|
||||
break;
|
||||
@@ -1179,9 +1152,9 @@ WifiPhy::EndSync (Packet const packet, Ptr<RxEvent> event)
|
||||
* all SNIR changes in the snir vector.
|
||||
*/
|
||||
double per = CalculatePer (event, &ni);
|
||||
TRACE ("mode="<<((uint32_t)event->GetPayloadMode ())<<
|
||||
", ber="<<(1-GetMode (event->GetPayloadMode ())->GetChunkSuccessRate (snr, 1))<<
|
||||
", snr="<<snr<<", per="<<per<<", size="<<packet.GetSize ());
|
||||
NS_LOG_DEBUG ("mode="<<(event->GetPayloadMode ().GetPhyRate ())<<
|
||||
", ber="<<(1-GetChunkSuccessRate (event->GetPayloadMode (), snr, 1))<<
|
||||
", snr="<<snr<<", per="<<per<<", size="<<packet.GetSize ());
|
||||
|
||||
if (m_random.GetValue () > per)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user