22 #include "ns3/assert.h"
23 #include "ns3/abort.h"
24 #include "ns3/simulator.h"
25 #include "ns3/nstime.h"
26 #include "ns3/config.h"
39 : m_interval (Seconds (1.0))
47 std::ostringstream oss;
49 <<
"_" << std::setfill (
'0') << std::setw (3) << std::right << nodeid
50 <<
"_" << std::setfill (
'0') << std::setw (3) << std::right << deviceid;
51 athstats->Open (oss.str ());
54 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid;
55 std::string devicepath = oss.str ();
74 EnableAthstats (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
84 EnableAthstats (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
113 static TypeId tid =
TypeId (
"ns3::AthstatsWifiTraceSink")
115 .AddConstructor<AthstatsWifiTraceSink> ()
116 .AddAttribute (
"Interval",
117 "Time interval between reports",
128 m_shortRetryCount (0),
129 m_longRetryCount (0),
130 m_exceededRetryCount (0),
132 m_phyRxErrorCount (0),
225 NS_LOG_FUNCTION (
this << context << packet <<
" mode=" << mode <<
" snr=" << snr );
264 m_writer->open (name.c_str (), std::ios_base::binary | std::ios_base::out);
265 NS_ABORT_MSG_IF (
m_writer->fail (),
"AthstatsWifiTraceSink::Open (): m_writer->open (" << name.c_str () <<
") failed");
280 snprintf (str, 200,
"%8u %8u %7u %7u %7u %6u %6u %6u %7u %4u %3uM\n",
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
keep track of time values and allow control of global simulation resolution
void PhyRxErrorTrace(std::string context, Ptr< const Packet > packet, double snr)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
void DevTxTrace(std::string context, Ptr< const Packet > p)
void PhyStateTrace(std::string context, Time start, Time duration, enum WifiPhy::State state)
void TxFinalRtsFailedTrace(std::string context, Mac48Address address)
std::vector< Ptr< Node > >::const_iterator Iterator
#define NS_LOG_COMPONENT_DEFINE(name)
virtual ~AthstatsWifiTraceSink()
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
void TxRtsFailedTrace(std::string context, Mac48Address address)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
void Connect(std::string path, const CallbackBase &cb)
uint32_t m_shortRetryCount
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if cond is false.
trace sink for wifi device that mimics madwifi's athstats tool.
hold objects of type ns3::Time
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > GetDevice(uint32_t index) const
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
#define NS_LOG_LOGIC(msg)
uint32_t GetNDevices(void) const
void Open(std::string const &name)
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
uint32_t m_exceededRetryCount
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
uint32_t m_longRetryCount
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
uint32_t m_phyRxErrorCount
#define NS_ASSERT_MSG(condition, message)
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. Both limits are inclusive.
void PhyRxOkTrace(std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, enum WifiPreamble preamble)
void TxFinalDataFailedTrace(std::string context, Mac48Address address)
a base class which provides memory management and object aggregation
void TxDataFailedTrace(std::string context, Mac48Address address)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void DevRxTrace(std::string context, Ptr< const Packet > p)
static TypeId GetTypeId(void)