--- a/src/lte/helper/radio-bearer-stats-calculator.cc Sat Mar 24 11:21:20 2012 +0100
+++ b/src/lte/helper/radio-bearer-stats-calculator.cc Mon Mar 26 13:09:35 2012 +0200
@@ -32,23 +32,25 @@
NS_OBJECT_ENSURE_REGISTERED ( RadioBearerStatsCalculator);
-RadioBearerStatsCalculator::RadioBearerStatsCalculator () :
- m_firstWrite (true), m_bearerType ("RLC")
+RadioBearerStatsCalculator::RadioBearerStatsCalculator ()
+ : m_firstWrite (true),
+ m_pendingOutput (false),
+ m_protocolType ("RLC")
{
NS_LOG_FUNCTION (this);
}
-RadioBearerStatsCalculator::RadioBearerStatsCalculator (std::string bearerType) :
- m_firstWrite (true)
+RadioBearerStatsCalculator::RadioBearerStatsCalculator (std::string protocolType)
+ : m_firstWrite (true),
+ m_pendingOutput (false)
{
NS_LOG_FUNCTION (this);
- m_bearerType = bearerType;
+ m_protocolType = protocolType;
}
RadioBearerStatsCalculator::~RadioBearerStatsCalculator ()
{
NS_LOG_FUNCTION (this);
- ShowResults ();
}
TypeId
@@ -84,6 +86,16 @@
}
void
+RadioBearerStatsCalculator::DoDispose ()
+{
+ NS_LOG_FUNCTION (this);
+ if (m_pendingOutput)
+ {
+ ShowResults ();
+ }
+}
+
+void
RadioBearerStatsCalculator::UlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
NS_LOG_FUNCTION (this << "UlTxPDU" << imsi << rnti << (uint32_t) lcid << packetSize);
@@ -95,6 +107,7 @@
m_ulTxPackets[p]++;
m_ulTxData[p] += packetSize;
}
+ m_pendingOutput = true;
}
void
@@ -110,6 +123,7 @@
m_dlTxPackets[p]++;
m_dlTxData[p] += packetSize;
}
+ m_pendingOutput = true;
}
void
@@ -136,6 +150,7 @@
m_ulDelay[p]->Update (delay);
m_ulPduSize[p]->Update (packetSize);
}
+ m_pendingOutput = true;
}
void
@@ -159,6 +174,7 @@
m_dlDelay[p]->Update (delay);
m_dlPduSize[p]->Update (packetSize);
}
+ m_pendingOutput = true;
}
void
@@ -215,6 +231,7 @@
WriteUlResults (ulOutFile);
WriteDlResults (dlOutFile);
+ m_pendingOutput = false;
}
@@ -556,7 +573,7 @@
std::string
RadioBearerStatsCalculator::GetUlOutputFilename (void)
{
- if (m_bearerType == "RLC")
+ if (m_protocolType == "RLC")
{
return LteStatsCalculator::GetUlOutputFilename ();
}
@@ -569,7 +586,7 @@
std::string
RadioBearerStatsCalculator::GetDlOutputFilename (void)
{
- if (m_bearerType == "RLC")
+ if (m_protocolType == "RLC")
{
return LteStatsCalculator::GetDlOutputFilename ();
}
--- a/src/lte/helper/radio-bearer-stats-calculator.h Sat Mar 24 11:21:20 2012 +0100
+++ b/src/lte/helper/radio-bearer-stats-calculator.h Mon Mar 26 13:09:35 2012 +0200
@@ -63,7 +63,7 @@
/**
* Class constructor
*/
- RadioBearerStatsCalculator (std::string bearerType);
+ RadioBearerStatsCalculator (std::string protocolType);
/**
* Class destructor
@@ -74,8 +74,8 @@
/**
* Inherited from ns3::Object
*/
- static TypeId
- GetTypeId (void);
+ static TypeId GetTypeId (void);
+ void DoDispose ();
/**
* Get the name of the file where the uplink statistics will be stored.
@@ -342,8 +342,16 @@
*/
Time m_epochDuration;
+ /**
+ * true if output files have not been opened yet
+ */
bool m_firstWrite;
- std::string m_bearerType;
+
+ /**
+ * true if any output is pending
+ */
+ bool m_pendingOutput;
+ std::string m_protocolType;
std::string m_dlPdcpOutputFilename;
std::string m_ulPdcpOutputFilename;