7#ifndef WIFI_CO_HELPER_H
8#define WIFI_CO_HELPER_H
10#include "ns3/callback.h"
11#include "ns3/config.h"
12#include "ns3/nstime.h"
14#include "ns3/simulator.h"
15#include "ns3/wifi-phy-state.h"
27class NetDeviceContainer;
184 const std::map<WifiPhyState, Time>& linkStates)
const;
195 const std::map<WifiPhyState, Time>& linkStates,
204 void AlignDecimal(std::vector<std::string>& column)
const;
212 void AlignWidth(std::vector<std::string>& column)
const;
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Unit
The unit to use to interpret a number representing time.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
Track channel occupancy durations for WifiNetDevice.
std::map< WifiPhyState, double > ComputePercentage(const std::map< WifiPhyState, Time > &linkStates) const
A helper function used by PrintStatistics method.
void AlignWidth(std::vector< std::string > &column) const
A helper function used by PrintLinkStates method to format the output.
Time ComputeOverlappingDuration(Time start1, Time stop1, Time start2, Time stop2)
Compute overlapping time-duration between two intervals.
void Stop(Time stopTime)
Stops the collection of statistics at a specified time.
void Enable(NodeContainer nodes)
Enables trace collection for all nodes and WifiNetDevices in the specified NodeContainer.
void PrintStatistics(std::ostream &os, Time::Unit unit=Time::Unit::AUTO) const
Print measurement results on an output stream.
Time m_stopTime
Instant at which statistics collection should stop.
void Start(Time startTime)
Starts the collection of statistics from a specified start time.
Time m_startTime
Instant at which statistics collection should start.
std::ostream & PrintLinkStates(std::ostream &os, const std::map< WifiPhyState, Time > &linkStates, Time::Unit unit) const
A helper function used by PrintStatistics method.
void NotifyWifiPhyState(std::size_t idx, std::size_t phyId, Time start, Time duration, WifiPhyState state)
A callback used to update statistics.
std::vector< DeviceRecord > m_deviceRecords
Stores the collected statistics.
const std::vector< DeviceRecord > & GetDeviceRecords() const
Returns measurement results on each installed device.
void AlignDecimal(std::vector< std::string > &column) const
A helper function used by PrintLinkStates method to format the output.
uint32_t m_numDevices
Count the number of devices traced by this helper.
void Reset()
Resets the current statistics, clearing all links and their durations.
WifiCoTraceHelper()
Default Constructor.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
Keeps track of channel occupancy statistics observed at a WifiNetDevice.
std::map< uint8_t, std::map< WifiPhyState, Time > > m_linkStateDurations
Duration statistics by link and state.
uint32_t m_nodeId
Id of Node on which the WifiNetDevice is installed.
uint32_t m_ifIndex
Device Id of WifiNetDevice.
void AddLinkMeasurement(size_t linkId, Time start, Time duration, WifiPhyState state)
Update the duration statistics for the provided linkId and state.
std::string m_deviceName
Device name. It's empty if the name isn't configured.
DeviceRecord(Ptr< WifiNetDevice > device)
Constructor.
std::string m_nodeName
Name of Node on which the WifiNetDevice is installed.