--- a/CHANGES.html Sun Dec 11 13:25:42 2016 +0100
+++ b/CHANGES.html Sun Dec 11 16:23:26 2016 +0100
@@ -58,6 +58,7 @@
parameter to specify the time units used on the report. The new parameter is
optional and if not specified defaults to the previous behavior (Time::S).
</li>
+<li><b>TxopTrace</b>: new trace source exported by EdcaTxopN.</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
--- a/RELEASE_NOTES Sun Dec 11 13:25:42 2016 +0100
+++ b/RELEASE_NOTES Sun Dec 11 16:23:26 2016 +0100
@@ -27,6 +27,7 @@
- Bug 2007 - uan: Remove deprecation on SetRxThresholdDb
- Bug 2221 - network: Remove constraint on size of ns3::Packet Tag objects
- Bug 2450 - LogDistancePropagationLossModel is not continuous
+- Bug 2463 - create trace source to trace the TXOP time that is actually used
- Bug 2477 - DCF manager assert
- Bug 2492 - uan: Make use of RxGain attribute in UanPhyGen class
- Bug 2511 - HT Greenfield is not working
--- a/src/wifi/model/edca-txop-n.cc Sun Dec 11 13:25:42 2016 +0100
+++ b/src/wifi/model/edca-txop-n.cc Sun Dec 11 16:23:26 2016 +0100
@@ -248,6 +248,10 @@
"Trace source for contention window values",
MakeTraceSourceAccessor (&EdcaTxopN::m_cwTrace),
"ns3::TracedValue::Uint32Callback")
+ .AddTraceSource ("TxopTrace",
+ "Trace source for txop start and duration times",
+ MakeTraceSourceAccessor (&EdcaTxopN::m_txopTrace),
+ "ns3::TracedValueCallback::Time")
;
return tid;
}
@@ -1184,9 +1188,10 @@
EdcaTxopN::StartNext (void)
{
NS_LOG_FUNCTION (this);
+ NS_ASSERT (GetTxopLimit () == NanoSeconds (0) || Simulator::Now () - m_startTxop <= GetTxopLimit ());
+
WifiMacHeader hdr;
Time tstamp;
-
Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&hdr,
m_currentHdr.GetQosTid (),
WifiMacHeader::ADDR1,
@@ -1194,6 +1199,11 @@
&tstamp);
if (peekedPacket == 0)
{
+ if (GetTxopLimit () > NanoSeconds (0))
+ {
+ NS_ASSERT (Simulator::Now () - m_startTxop <= GetTxopLimit ());
+ m_txopTrace (m_startTxop, Simulator::Now () - m_startTxop);
+ }
return;
}
@@ -1227,6 +1237,11 @@
m_currentHdr.GetAddr1 ());
GetLow ()->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener);
}
+ else if (GetTxopLimit () > NanoSeconds (0))
+ {
+ NS_ASSERT (Simulator::Now () - m_startTxop <= GetTxopLimit ());
+ m_txopTrace (m_startTxop, Simulator::Now () - m_startTxop);
+ }
}
Time
--- a/src/wifi/model/edca-txop-n.h Sun Dec 11 13:25:42 2016 +0100
+++ b/src/wifi/model/edca-txop-n.h Sun Dec 11 16:23:26 2016 +0100
@@ -579,6 +579,7 @@
bool m_isAccessRequestedForRts;
TracedValue<uint32_t> m_backoffTrace;
TracedValue<uint32_t> m_cwTrace;
+ TracedCallback<Time, Time> m_txopTrace;
};
} //namespace ns3
--- a/src/wifi/test/wifi-test.cc Sun Dec 11 13:25:42 2016 +0100
+++ b/src/wifi/test/wifi-test.cc Sun Dec 11 16:23:26 2016 +0100
@@ -1023,6 +1023,9 @@
phy.SetChannel (channel.Create ());
WifiHelper wifi;
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+ "DataMode", StringValue ("OfdmRate54Mbps"),
+ "ControlMode", StringValue ("OfdmRate24Mbps"));
WifiMacHelper mac;
Ssid ssid = Ssid ("ns-3-ssid");
mac.SetType ("ns3::AdhocWifiMac",