--- a/src/devices/mesh/tx-statistics.cc Wed Apr 01 17:38:22 2009 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 <andreev@iitp.ru>
- */
-
-
-#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<Object> ()
- .AddConstructor<WifiTxStatistics> ();
- 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 = " <<lengthPos->first);
- for (RATE_STAT::iterator ratePos = lengthPos->second.begin (); ratePos != lengthPos->second.end(); ratePos ++)
- {
- NS_LOG_UNCOND ("Rate is "<<ratePos->first
- <<": SUCCESS = "<<ratePos->second.packetsAcked
- <<", RRETRY = " <<ratePos->second.packetsRetried
- <<", FAILURE = "<<ratePos->second.packetsFailed);
- }
- }
-}
-#endif
-} //namespace ns3
--- a/src/devices/mesh/tx-statistics.h Wed Apr 01 17:38:22 2009 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 <andreev@iitp.ru>
- */
-
-
-#ifndef TX_STAT_H
-#define TX_STAT_H
-
-#include <map>
-#include <utility>
-
-#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<uint32_t, SIMPLE_STAT> RATE_STAT;
-#if 0
- typedef std::map<uint16_t, SIMPLE_STAT> LENGTH_STAT;
-#endif
- typedef std::map<uint16_t, RATE_STAT> 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
--- a/src/devices/mesh/wscript Wed Apr 01 17:38:22 2009 +0400
+++ b/src/devices/mesh/wscript Wed Apr 01 17:50:19 2009 +0400
@@ -11,7 +11,7 @@
'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 @@
'mesh-wifi-interface-mac.h',
'mesh-wifi-interface-mac-plugin.h',
# Dirty
- 'tx-statistics.h',
+ #'tx-statistics.h',
'mesh-wifi-mac-header.h',
]
--- a/src/devices/wifi/wifi-remote-station-manager.cc Wed Apr 01 17:38:22 2009 +0400
+++ b/src/devices/wifi/wifi-remote-station-manager.cc Wed Apr 01 17:50:19 2009 +0400
@@ -422,9 +422,7 @@
: m_state (BRAND_NEW),
m_ssrc (0),
m_slrc (0)
-{
- m_txStat = CreateObject<WifiTxStatistics> ();
-}
+{}
WifiRemoteStation::~WifiRemoteStation ()
{}
@@ -545,7 +543,7 @@
WifiMode
WifiRemoteStation::GetAckMode (WifiMode dataMode)
{
- return dataMode;
+ return GetControlAnswerMode (dataMode);
}
uint32_t
@@ -574,14 +572,12 @@
{
if (GetManager ()->IsLowLatency ())
{
- m_txStat->NotifyDataSent(fullPacketSize, DoGetDataMode (fullPacketSize).GetDataRate());
return DoGetDataMode (fullPacketSize);
}
TxModeTag tag;
bool found;
found = ConstCast<Packet> (packet)->RemovePacketTag (tag);
NS_ASSERT (found);
- m_txStat->NotifyDataSent(fullPacketSize, tag.GetDataMode ().GetDataRate());
return tag.GetDataMode ();
}
WifiMode
@@ -589,14 +585,12 @@
{
if (GetManager ()->IsLowLatency ())
{
- m_txStat->NotifyDataSent(packet->GetSize() +36, DoGetRtsMode().GetDataRate());
return DoGetRtsMode ();
}
TxModeTag tag;
bool found;
found = ConstCast<Packet> (packet)->RemovePacketTag (tag);
NS_ASSERT (found);
- m_txStat->NotifyDataSent(packet->GetSize() +36, tag.GetRtsMode ().GetDataRate());
return tag.GetRtsMode ();
}
@@ -699,7 +693,6 @@
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 @@
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 @@
WifiRemoteStation::ReportFinalRtsFailed (void)
{
m_ssrc = 0;
- m_txStat->NotifyRtsFailed();
DoReportFinalRtsFailed ();
}
@@ -724,7 +715,6 @@
WifiRemoteStation::ReportFinalDataFailed (void)
{
m_slrc = 0;
- m_txStat->NotifyDataFailed();
DoReportFinalDataFailed ();
}
@@ -733,16 +723,5 @@
{
DoReportRxOk (rxSnr, txMode);
}
-WifiTxStatistics::TX_STATISTICS
-WifiRemoteStation::GetTxStat()
-{
- return m_txStat->GetTxStatRateLength();
-}
-void
-WifiRemoteStation::ResetTxStat()
-{
- m_txStat->ResetStatistics();
-}
-
} // namespace ns3
--- a/src/devices/wifi/wifi-remote-station-manager.h Wed Apr 01 17:38:22 2009 +0400
+++ b/src/devices/wifi/wifi-remote-station-manager.h Wed Apr 01 17:50:19 2009 +0400
@@ -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 @@
* handshake.
*/
WifiMode GetAckMode (WifiMode dataMode);
- WifiTxStatistics::TX_STATISTICS GetTxStat();
- void ResetTxStat();
private:
typedef std::vector<WifiMode> SupportedModes;
@@ -289,7 +286,6 @@
SupportedModes m_modes;
TracedValue<uint32_t> m_ssrc;
TracedValue<uint32_t> m_slrc;
- Ptr<WifiTxStatistics> m_txStat;
};
} // namespace ns3