From 1bcc51a60137d9264df38e137e08b886e9ea25c5 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Wed, 1 Apr 2009 17:50:19 +0400 Subject: [PATCH] Reverted changes in wif-remote-station-manager concerned with tx-statistics --- src/devices/mesh/tx-statistics.cc | 185 ------------------ src/devices/mesh/tx-statistics.h | 105 ---------- src/devices/mesh/wscript | 4 +- .../wifi/wifi-remote-station-manager.cc | 25 +-- .../wifi/wifi-remote-station-manager.h | 4 - 5 files changed, 4 insertions(+), 319 deletions(-) delete mode 100644 src/devices/mesh/tx-statistics.cc delete mode 100644 src/devices/mesh/tx-statistics.h diff --git a/src/devices/mesh/tx-statistics.cc b/src/devices/mesh/tx-statistics.cc deleted file mode 100644 index 490f7997b..000000000 --- a/src/devices/mesh/tx-statistics.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2008,2009 IITP RAS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Kirill Andreev - */ - - -#include "ns3/tx-statistics.h" -#include "ns3/assert.h" -#include "ns3/log.h" - -NS_LOG_COMPONENT_DEFINE ("WifiTxStatistics"); - -namespace ns3 { - -TypeId -WifiTxStatistics::GetTypeId (void) -{ - static TypeId tid = TypeId ("ns3::WifiTxStatistics") - .SetParent () - .AddConstructor (); - return tid; -} -WifiTxStatistics::WifiTxStatistics (): - m_numOfGroups (10), - m_maxLength (2500) -{ -} -WifiTxStatistics::~WifiTxStatistics () -{ -} -void -WifiTxStatistics::SetLengthDivisionParams (uint16_t maxLength, uint8_t numOfGroups) -{ - -} -void -WifiTxStatistics::NotifyDataSent (uint16_t length, uint32_t dataRate) -{ - m_currentSize = length; - m_currentRate = dataRate; -} - -WifiTxStatistics::RATE_STAT::iterator -WifiTxStatistics::FillCurrentStatPosition (uint16_t length, uint32_t dataRate) -{ - uint16_t group = (length/ (m_maxLength/m_numOfGroups)+1)* (m_maxLength/m_numOfGroups); -#if 0 - for (RATE_LENGTH_STAT::iterator i = m_stats.begin (); i != m_stats.end(); i ++) - if (i->first == ) -#endif - RATE_LENGTH_STAT::iterator lengthPos = m_stats.find (group); - if (lengthPos == m_stats.end ()) - { - RATE_STAT newStat; - m_stats[group] = newStat; - } - lengthPos = m_stats.find (group); - NS_ASSERT (lengthPos != m_stats.end()); - RATE_STAT::iterator ratePos = lengthPos->second.find (dataRate); - if (ratePos == lengthPos->second.end ()) - { - SIMPLE_STAT newStat; - newStat.packetsFailed =0; - newStat.packetsRetried = 0; - newStat.packetsAcked = 0; - newStat.rtsFailed = 0; - newStat.rtsRetried = 0; - newStat.rtsAcked = 0; - newStat.bytesFailed = 0; - newStat.bytesRetried = 0; - newStat.bytesAcked = 0; - lengthPos->second[dataRate] = newStat; - } - ratePos = lengthPos->second.find (dataRate); - NS_ASSERT (ratePos != lengthPos->second.end()); - return ratePos; -} - -void -WifiTxStatistics::NotifyDataFailed () -{ - RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate); - ratePos->second.packetsFailed++; - ratePos->second.bytesFailed += m_currentSize; -} - -void -WifiTxStatistics::NotifyGotAck (uint32_t retryCounter) -{ - RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate); - ratePos->second.packetsAcked++; - ratePos->second.packetsRetried += retryCounter; - ratePos->second.bytesAcked+= m_currentSize; - ratePos->second.bytesRetried += (m_currentSize*retryCounter); -} - -void -WifiTxStatistics::NotifyRtsSend (uint32_t rtsRate, uint32_t dataLength) -{ - m_currentSize = dataLength; - m_currentRate = rtsRate; -} - -void -WifiTxStatistics::NotifyRtsFailed () -{ - RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate); - ratePos->second.rtsFailed++; - ratePos->second.bytesFailed += m_currentSize; -} - -void -WifiTxStatistics::NotifyRtsSuccess (uint32_t retryCounter) -{ - RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate); - ratePos->second.rtsAcked++; - ratePos->second.rtsRetried += retryCounter; - ratePos->second.bytesAcked += m_currentSize; - ratePos->second.bytesRetried += (m_currentSize*retryCounter); -} - -void -WifiTxStatistics::ResetStatistics () -{ - for (RATE_LENGTH_STAT::iterator lengthPos = m_stats.begin (); lengthPos != m_stats.end(); lengthPos++) - lengthPos->second.clear (); -} -#if 0 -WifiTxStatistics::SIMPLE_STAT -WifiTxStatistics::GetTxStatCommon () -{ -} - -WifiTxStatistics::RATE_STAT -WifiTxStatistics::GetTxStatRate () -{ -} - -WifiTxStatistics::LENGTH_STAT -WifiTxStatistics::GetTxStatLength () -{ -} -#endif -WifiTxStatistics::TX_STATISTICS -WifiTxStatistics::GetTxStatRateLength () -{ - TX_STATISTICS retval; - retval.statistics = m_stats; - retval.lengthInterval = m_maxLength / m_numOfGroups; - retval.maxLength = m_maxLength; - return retval; -} -#if 0 -void -WifiTxStatistics::Print () -{ - for (RATE_LENGTH_STAT::iterator lengthPos = m_stats.begin (); lengthPos != m_stats.end(); lengthPos++) - { - NS_LOG_UNCOND ("\tGROUP = " <first); - for (RATE_STAT::iterator ratePos = lengthPos->second.begin (); ratePos != lengthPos->second.end(); ratePos ++) - { - NS_LOG_UNCOND ("Rate is "<first - <<": SUCCESS = "<second.packetsAcked - <<", RRETRY = " <second.packetsRetried - <<", FAILURE = "<second.packetsFailed); - } - } -} -#endif -} //namespace ns3 diff --git a/src/devices/mesh/tx-statistics.h b/src/devices/mesh/tx-statistics.h deleted file mode 100644 index 5be898aa2..000000000 --- a/src/devices/mesh/tx-statistics.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2008,2009 IITP RAS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Kirill Andreev - */ - - -#ifndef TX_STAT_H -#define TX_STAT_H - -#include -#include - -#include "ns3/mac48-address.h" -#include "ns3/packet.h" -#include "ns3/object.h" -#include "ns3/traced-value.h" -#include "ns3/wifi-mode.h" - -namespace ns3 { -class WifiTxStatistics : public Object -{ -public: - static TypeId GetTypeId (void); - WifiTxStatistics (); - ~WifiTxStatistics (); - - struct TxStat - { - /** - * Packet counters: - */ - uint32_t packetsFailed; - uint32_t packetsRetried; - uint32_t packetsAcked; - /** - * RTS counters: - */ - uint32_t rtsFailed; - uint32_t rtsRetried; - uint32_t rtsAcked; - /** - * Byte counters: - */ - uint64_t bytesFailed; - uint64_t bytesRetried; - uint64_t bytesAcked; - }; - typedef struct TxStat SIMPLE_STAT; - typedef std::map RATE_STAT; -#if 0 - typedef std::map LENGTH_STAT; -#endif - typedef std::map RATE_LENGTH_STAT; - - void SetLengthDivisionParams (uint16_t maxLength, uint8_t numOfGroups); - - void NotifyDataSent (uint16_t length, uint32_t dataRate); - void NotifyDataFailed (); - void NotifyGotAck (uint32_t retryCounter); - - void NotifyRtsSend (uint32_t rtsRate, uint32_t dataLength); - void NotifyRtsRetried (); - void NotifyRtsFailed (); - void NotifyRtsSuccess (uint32_t retryCounter); - - void ResetStatistics (); -#if 0 - SIMPLE_STAT GetTxStatCommon (); - RATE_STAT GetTxStatRate (); - LENGTH_STAT GetTxStatLength (); -#endif - typedef struct { - RATE_LENGTH_STAT statistics; - uint16_t lengthInterval; - uint16_t maxLength; - } TX_STATISTICS; - TX_STATISTICS GetTxStatRateLength (); -private: - RATE_STAT::iterator FillCurrentStatPosition (uint16_t length, uint32_t dataRate); - //DEBUG PURPOSE - //void Print (); - RATE_LENGTH_STAT m_stats; - bool m_isTx; - uint8_t m_numOfGroups; - uint16_t m_maxLength; - uint16_t m_currentSize; - uint32_t m_currentRate; -}; -} //namespace ns3 -#endif diff --git a/src/devices/mesh/wscript b/src/devices/mesh/wscript index f1cef54b1..86c046b36 100644 --- a/src/devices/mesh/wscript +++ b/src/devices/mesh/wscript @@ -11,7 +11,7 @@ def build(bld): 'mesh-wifi-interface-mac.cc', # Not refactored 'mesh-wifi-mac-header.cc', - 'tx-statistics.cc', + #'tx-statistics.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'mesh' @@ -24,7 +24,7 @@ def build(bld): 'mesh-wifi-interface-mac.h', 'mesh-wifi-interface-mac-plugin.h', # Dirty - 'tx-statistics.h', + #'tx-statistics.h', 'mesh-wifi-mac-header.h', ] diff --git a/src/devices/wifi/wifi-remote-station-manager.cc b/src/devices/wifi/wifi-remote-station-manager.cc index 006d17fe8..1d0a88482 100644 --- a/src/devices/wifi/wifi-remote-station-manager.cc +++ b/src/devices/wifi/wifi-remote-station-manager.cc @@ -422,9 +422,7 @@ WifiRemoteStation::WifiRemoteStation () : m_state (BRAND_NEW), m_ssrc (0), m_slrc (0) -{ - m_txStat = CreateObject (); -} +{} WifiRemoteStation::~WifiRemoteStation () {} @@ -545,7 +543,7 @@ WifiRemoteStation::GetCtsMode (WifiMode rtsMode) WifiMode WifiRemoteStation::GetAckMode (WifiMode dataMode) { - return dataMode; + return GetControlAnswerMode (dataMode); } uint32_t @@ -574,14 +572,12 @@ WifiRemoteStation::GetDataMode (Ptr packet, uint32_t fullPacketSiz { if (GetManager ()->IsLowLatency ()) { - m_txStat->NotifyDataSent(fullPacketSize, DoGetDataMode (fullPacketSize).GetDataRate()); return DoGetDataMode (fullPacketSize); } TxModeTag tag; bool found; found = ConstCast (packet)->RemovePacketTag (tag); NS_ASSERT (found); - m_txStat->NotifyDataSent(fullPacketSize, tag.GetDataMode ().GetDataRate()); return tag.GetDataMode (); } WifiMode @@ -589,14 +585,12 @@ WifiRemoteStation::GetRtsMode (Ptr packet) { if (GetManager ()->IsLowLatency ()) { - m_txStat->NotifyDataSent(packet->GetSize() +36, DoGetRtsMode().GetDataRate()); return DoGetRtsMode (); } TxModeTag tag; bool found; found = ConstCast (packet)->RemovePacketTag (tag); NS_ASSERT (found); - m_txStat->NotifyDataSent(packet->GetSize() +36, tag.GetRtsMode ().GetDataRate()); return tag.GetRtsMode (); } @@ -699,7 +693,6 @@ WifiRemoteStation::ReportDataFailed (void) void WifiRemoteStation::ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr) { - m_txStat->NotifyRtsSuccess(m_ssrc); m_ssrc = 0; DoReportRtsOk (ctsSnr, ctsMode, rtsSnr); } @@ -707,7 +700,6 @@ WifiRemoteStation::ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr) void WifiRemoteStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr) { - m_txStat->NotifyGotAck(m_slrc); m_slrc = 0; DoReportDataOk (ackSnr, ackMode, dataSnr); } @@ -716,7 +708,6 @@ void WifiRemoteStation::ReportFinalRtsFailed (void) { m_ssrc = 0; - m_txStat->NotifyRtsFailed(); DoReportFinalRtsFailed (); } @@ -724,7 +715,6 @@ void WifiRemoteStation::ReportFinalDataFailed (void) { m_slrc = 0; - m_txStat->NotifyDataFailed(); DoReportFinalDataFailed (); } @@ -733,16 +723,5 @@ WifiRemoteStation::ReportRxOk (double rxSnr, WifiMode txMode) { DoReportRxOk (rxSnr, txMode); } -WifiTxStatistics::TX_STATISTICS -WifiRemoteStation::GetTxStat() -{ - return m_txStat->GetTxStatRateLength(); -} -void -WifiRemoteStation::ResetTxStat() -{ - m_txStat->ResetStatistics(); -} - } // namespace ns3 diff --git a/src/devices/wifi/wifi-remote-station-manager.h b/src/devices/wifi/wifi-remote-station-manager.h index c67afc3a7..00e23f485 100644 --- a/src/devices/wifi/wifi-remote-station-manager.h +++ b/src/devices/wifi/wifi-remote-station-manager.h @@ -26,7 +26,6 @@ #include "ns3/packet.h" #include "ns3/object.h" #include "ns3/traced-value.h" -#include "ns3/tx-statistics.h" #include "wifi-mode.h" namespace ns3 { @@ -258,8 +257,6 @@ public: * handshake. */ WifiMode GetAckMode (WifiMode dataMode); - WifiTxStatistics::TX_STATISTICS GetTxStat(); - void ResetTxStat(); private: typedef std::vector SupportedModes; @@ -289,7 +286,6 @@ private: SupportedModes m_modes; TracedValue m_ssrc; TracedValue m_slrc; - Ptr m_txStat; }; } // namespace ns3