trace sink for wifi device that mimics madwifi's athstats tool. More...
#include "athstats-helper.h"
Public Member Functions | |
AthstatsWifiTraceSink () | |
~AthstatsWifiTraceSink () override | |
void | DevRxTrace (std::string context, Ptr< const Packet > p) |
function to be called when the net device receives a packet | |
void | DevTxTrace (std::string context, Ptr< const Packet > p) |
function to be called when the net device transmits a packet | |
void | Open (const std::string &name) |
Open a file for output. | |
void | PhyRxErrorTrace (std::string context, Ptr< const Packet > packet, double snr) |
Function to be called when a frame reception by the PHY layer of the considered device resulted in an error due to a failure in the CRC check of the frame. | |
void | PhyRxOkTrace (std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble) |
Function to be called when the PHY layer of the considered device receives a frame. | |
void | PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState state) |
Function to be called when the PHY layer of the considered device changes state. | |
void | PhyTxTrace (std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower) |
Function to be called when a frame is being transmitted by the PHY layer of the considered device. | |
void | TxDataFailedTrace (std::string context, Mac48Address address) |
Function to be called when a data frame transmission by the considered device has failed. | |
void | TxFinalDataFailedTrace (std::string context, Mac48Address address) |
Function to be called when the transmission of a data frame has exceeded the retry limit. | |
void | TxFinalRtsFailedTrace (std::string context, Mac48Address address) |
Function to be called when the transmission of a RTS frame has exceeded the retry limit. | |
void | TxRtsFailedTrace (std::string context, Mac48Address address) |
Function to be called when a RTS frame transmission by the considered device has failed. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Member Functions | |
void | ResetCounters () |
Reset counters function. | |
void | WriteStats () |
Write status function. | |
Private Attributes | |
uint32_t | m_exceededRetryCount |
exceeded retry count | |
Time | m_interval |
interval | |
uint32_t | m_longRetryCount |
long retry count | |
uint32_t | m_phyRxErrorCount |
PHY receive error count. | |
uint32_t | m_phyRxOkCount |
PHY receive OK count. | |
uint32_t | m_phyTxCount |
PHY transmit count. | |
uint32_t | m_rxCount |
receive count | |
uint32_t | m_shortRetryCount |
short retry count | |
uint32_t | m_txCount |
transmit count | |
std::ofstream * | m_writer |
output stream | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
trace sink for wifi device that mimics madwifi's athstats tool.
The AthstatsWifiTraceSink class is a trace sink to be connected to several of the traces available within a wifi device. The purpose of AthstatsWifiTraceSink is to mimic the behavior of the athstats tool distributed with the madwifi driver. In particular, the reproduced behavior is that obtained when executing athstats without parameters: a report written in text format is produced every fixed interval, based on the events observed by the wifi device.
Differences with the "real" athstats:
Definition at line 93 of file athstats-helper.h.
ns3::AthstatsWifiTraceSink::AthstatsWifiTraceSink | ( | ) |
Definition at line 119 of file athstats-helper.cc.
References ns3::Simulator::ScheduleNow(), and WriteStats().
|
override |
Definition at line 133 of file athstats-helper.cc.
References m_writer, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
function to be called when the net device receives a packet
context | the calling context |
p | the packet being received |
Definition at line 179 of file athstats-helper.cc.
References m_rxCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
function to be called when the net device transmits a packet
context | the calling context |
p | the packet being transmitted |
Definition at line 172 of file athstats-helper.cc.
References m_txCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
|
static |
Get the type ID.
Definition at line 105 of file athstats-helper.cc.
References m_interval, ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::Seconds(), and ns3::TypeId::SetParent().
void ns3::AthstatsWifiTraceSink::Open | ( | const std::string & | name | ) |
Open a file for output.
name | the name of the file to be opened. |
Definition at line 254 of file athstats-helper.cc.
References m_writer, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
void ns3::AthstatsWifiTraceSink::PhyRxErrorTrace | ( | std::string | context, |
Ptr< const Packet > | packet, | ||
double | snr ) |
Function to be called when a frame reception by the PHY layer of the considered device resulted in an error due to a failure in the CRC check of the frame.
context | the calling context |
packet | the packet |
snr | the SNR in linear scale |
Definition at line 226 of file athstats-helper.cc.
References m_phyRxErrorCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
void ns3::AthstatsWifiTraceSink::PhyRxOkTrace | ( | std::string | context, |
Ptr< const Packet > | packet, | ||
double | snr, | ||
WifiMode | mode, | ||
WifiPreamble | preamble ) |
Function to be called when the PHY layer of the considered device receives a frame.
context | the calling context |
packet | the packet |
snr | the SNR in linear scale |
mode | the WifiMode |
preamble | the wifi preamble |
Definition at line 214 of file athstats-helper.cc.
References m_phyRxOkCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
void ns3::AthstatsWifiTraceSink::PhyStateTrace | ( | std::string | context, |
Time | start, | ||
Time | duration, | ||
WifiPhyState | state ) |
Function to be called when the PHY layer of the considered device changes state.
context | the calling context |
start | the time at which the state changed |
duration | the duration of the state |
state | the PHY layer state |
Definition at line 245 of file athstats-helper.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
void ns3::AthstatsWifiTraceSink::PhyTxTrace | ( | std::string | context, |
Ptr< const Packet > | packet, | ||
WifiMode | mode, | ||
WifiPreamble | preamble, | ||
uint8_t | txPower ) |
Function to be called when a frame is being transmitted by the PHY layer of the considered device.
context | the calling context |
packet | the packet |
mode | the WifiMode |
preamble | the wifi preamble |
txPower | the transmit power level |
Definition at line 233 of file athstats-helper.cc.
References m_phyTxCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
|
private |
Reset counters function.
Definition at line 159 of file athstats-helper.cc.
References m_exceededRetryCount, m_longRetryCount, m_phyRxErrorCount, m_phyRxOkCount, m_phyTxCount, m_rxCount, m_shortRetryCount, and m_txCount.
Referenced by WriteStats().
void ns3::AthstatsWifiTraceSink::TxDataFailedTrace | ( | std::string | context, |
Mac48Address | address ) |
Function to be called when a data frame transmission by the considered device has failed.
context | the calling context |
address | the MAC address of the remote station |
Definition at line 193 of file athstats-helper.cc.
References m_longRetryCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
void ns3::AthstatsWifiTraceSink::TxFinalDataFailedTrace | ( | std::string | context, |
Mac48Address | address ) |
Function to be called when the transmission of a data frame has exceeded the retry limit.
context | the calling context |
address | the MAC address of the remote station |
Definition at line 207 of file athstats-helper.cc.
References m_exceededRetryCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
void ns3::AthstatsWifiTraceSink::TxFinalRtsFailedTrace | ( | std::string | context, |
Mac48Address | address ) |
Function to be called when the transmission of a RTS frame has exceeded the retry limit.
context | the calling context |
address | the MAC address of the remote station |
Definition at line 200 of file athstats-helper.cc.
References m_exceededRetryCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
void ns3::AthstatsWifiTraceSink::TxRtsFailedTrace | ( | std::string | context, |
Mac48Address | address ) |
Function to be called when a RTS frame transmission by the considered device has failed.
context | the calling context |
address | the MAC address of the remote station |
Definition at line 186 of file athstats-helper.cc.
References m_shortRetryCount, and NS_LOG_FUNCTION.
Referenced by ns3::AthstatsHelper::EnableAthstats().
|
private |
Write status function.
Definition at line 276 of file athstats-helper.cc.
References m_exceededRetryCount, m_interval, m_longRetryCount, m_phyRxErrorCount, m_rxCount, m_shortRetryCount, m_txCount, m_writer, NS_LOG_FUNCTION, ResetCounters(), ns3::Simulator::Schedule(), and WriteStats().
Referenced by AthstatsWifiTraceSink(), and WriteStats().
|
private |
exceeded retry count
Definition at line 227 of file athstats-helper.h.
Referenced by ResetCounters(), TxFinalDataFailedTrace(), TxFinalRtsFailedTrace(), and WriteStats().
|
private |
interval
Definition at line 234 of file athstats-helper.h.
Referenced by GetTypeId(), and WriteStats().
|
private |
long retry count
Definition at line 226 of file athstats-helper.h.
Referenced by ResetCounters(), TxDataFailedTrace(), and WriteStats().
|
private |
PHY receive error count.
Definition at line 229 of file athstats-helper.h.
Referenced by PhyRxErrorTrace(), ResetCounters(), and WriteStats().
|
private |
PHY receive OK count.
Definition at line 228 of file athstats-helper.h.
Referenced by PhyRxOkTrace(), and ResetCounters().
|
private |
PHY transmit count.
Definition at line 230 of file athstats-helper.h.
Referenced by PhyTxTrace(), and ResetCounters().
|
private |
receive count
Definition at line 224 of file athstats-helper.h.
Referenced by DevRxTrace(), ResetCounters(), and WriteStats().
|
private |
short retry count
Definition at line 225 of file athstats-helper.h.
Referenced by ResetCounters(), TxRtsFailedTrace(), and WriteStats().
|
private |
transmit count
Definition at line 223 of file athstats-helper.h.
Referenced by DevTxTrace(), ResetCounters(), and WriteStats().
|
private |
output stream
Definition at line 232 of file athstats-helper.h.
Referenced by ~AthstatsWifiTraceSink(), Open(), and WriteStats().