This commit is contained in:
Nicola Baldo
2011-03-30 16:42:29 +02:00
4 changed files with 38 additions and 23 deletions

View File

@@ -26,7 +26,7 @@
#include "ns3/rlc-stats-calculator.h"
//#include "ns3/gtk-config-store.h"
#include "ns3/gtk-config-store.h"
using namespace ns3;
@@ -46,7 +46,8 @@ int main (int argc, char *argv[])
{
LenaHelper lena;
//lena.EnableLogComponents ();
// Enable LTE log components
lena.EnableLogComponents ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
@@ -87,8 +88,8 @@ int main (int argc, char *argv[])
Simulator::Run ();
// Uncomment to show available paths
//GtkConfigStore config;
//config.ConfigureAttributes ();
GtkConfigStore config;
config.ConfigureAttributes ();
Simulator::Destroy ();

View File

@@ -60,7 +60,7 @@ RlcStatsCalculator::GetTypeId (void)
void
RlcStatsCalculator::SetOutputFilename (std::string outputFilename)
{
m_outputFilename = outputFilename;
m_outputFilename = outputFilename;
}
void
@@ -95,37 +95,51 @@ RlcStatsCalculator::ShowResults (void)
uint32Map::iterator it;
uint64Map::iterator itData;
uint64StatsMap::iterator itDelay;
NS_LOG_INFO ( "#Parameter,RNTI,LCID,value");
NS_LOG_FUNCTION (this << m_outputFilename.c_str ());
NS_LOG_INFO ("Write Rlc Stats in: " << m_outputFilename.c_str ());
std::ofstream m_outFile;
m_outFile.open (m_outputFilename.c_str ());
if (! m_outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_outputFilename.c_str ());
return;
}
m_outFile << "# Parameter, RNTI, LCID, value" << std::endl;
for ( it = m_txPackets.begin(); it != m_txPackets.end(); ++it)
{
NS_LOG_INFO ("TxPackets, " << (*it).first.rnti << ", "
<< (uint32_t) (*it).first.lcid << ", "
<< (*it).second);
m_outFile << "TxPackets, " << (*it).first.rnti << ", "
<< (uint32_t) (*it).first.lcid << ", "
<< (*it).second << std::endl;
}
for ( it = m_rxPackets.begin(); it != m_rxPackets.end(); ++it)
{
NS_LOG_INFO ("RxPackets, " << (*it).first.rnti << ", "
<< (uint32_t) (*it).first.lcid << ", "
<< (*it).second);
m_outFile << "RxPackets, " << (*it).first.rnti << ", "
<< (uint32_t) (*it).first.lcid << ", "
<< (*it).second << std::endl;
}
for ( itData = m_rxData.begin(); itData != m_rxData.end(); ++itData)
{
NS_LOG_INFO ("RxData, " << (*itData).first.rnti << ", "
<< (uint32_t) (*itData).first.lcid << ", "
<< (*itData).second);
m_outFile << "RxData, " << (*itData).first.rnti << ", "
<< (uint32_t) (*itData).first.lcid << ", "
<< (*itData).second << std::endl;
}
for ( itData = m_rxData.begin(); itData != m_rxData.end(); ++itData)
{
NS_LOG_INFO ("Throughput, " << (*itData).first.rnti << ", "
<< (uint32_t) (*itData).first.lcid << ", "
<< GetThroughput ((*itData).first) );
m_outFile << "Throughput, " << (*itData).first.rnti << ", "
<< (uint32_t) (*itData).first.lcid << ", "
<< GetThroughput ((*itData).first) << std::endl;
}
for ( itDelay = m_delay.begin (); itDelay != m_delay.end (); ++itDelay)
{
NS_LOG_INFO ("Delay, " << (*itDelay).first.rnti << ", "
<< (uint32_t) (*itDelay).first.lcid << ", "
<< GetDelay ( (*itDelay).first));
m_outFile << "Delay, " << (*itDelay).first.rnti << ", "
<< (uint32_t) (*itDelay).first.lcid << ", "
<< GetDelay ((*itDelay).first) << std::endl;
}
m_outFile.close ();
}
uint32_t

View File

@@ -26,7 +26,7 @@
#include "ns3/basic-data-calculators.h"
#include <string>
#include <map>
#include <fstream>
namespace ns3 {
@@ -86,6 +86,7 @@ public:
private:
void ShowResults (void);
std::string m_outputFilename;
std::ofstream m_outFile;
uint32Map m_txPackets;
uint32Map m_rxPackets;
uint64Map m_rxData;

View File

@@ -405,7 +405,6 @@ operator << (std::ostream& os, const SpectrumValue& pvf)
os << *it1 << " " ;
++it1;
}
os << std::endl;
return os;
}