From dde1c0557cda426cae1c9ed59f2e09ab29db0ab0 Mon Sep 17 00:00:00 2001 From: mrequena Date: Wed, 30 Mar 2011 15:21:34 +0200 Subject: [PATCH 1/2] write Rlc Status into a file --- src/lte/examples/lena-rlc-calculator.cc | 3 +- src/lte/helper/rlc-stats-calculator.cc | 48 ++++++++++++++++--------- src/lte/helper/rlc-stats-calculator.h | 3 +- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/lte/examples/lena-rlc-calculator.cc b/src/lte/examples/lena-rlc-calculator.cc index 5d8312522..0f12fefc5 100644 --- a/src/lte/examples/lena-rlc-calculator.cc +++ b/src/lte/examples/lena-rlc-calculator.cc @@ -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; diff --git a/src/lte/helper/rlc-stats-calculator.cc b/src/lte/helper/rlc-stats-calculator.cc index 25df8defd..6509717d2 100644 --- a/src/lte/helper/rlc-stats-calculator.cc +++ b/src/lte/helper/rlc-stats-calculator.cc @@ -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 diff --git a/src/lte/helper/rlc-stats-calculator.h b/src/lte/helper/rlc-stats-calculator.h index d0624dacb..0e01f7dcc 100644 --- a/src/lte/helper/rlc-stats-calculator.h +++ b/src/lte/helper/rlc-stats-calculator.h @@ -26,7 +26,7 @@ #include "ns3/basic-data-calculators.h" #include #include - +#include 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; From cbd53e42f3531469734d72c8580101f35d151604 Mon Sep 17 00:00:00 2001 From: mrequena Date: Wed, 30 Mar 2011 15:33:52 +0200 Subject: [PATCH 2/2] Remove ugly endl --- src/lte/examples/lena-rlc-calculator.cc | 6 +++--- src/spectrum/model/spectrum-value.cc | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lte/examples/lena-rlc-calculator.cc b/src/lte/examples/lena-rlc-calculator.cc index 6f1e553e4..3eb75ee25 100644 --- a/src/lte/examples/lena-rlc-calculator.cc +++ b/src/lte/examples/lena-rlc-calculator.cc @@ -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; @@ -88,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 (); diff --git a/src/spectrum/model/spectrum-value.cc b/src/spectrum/model/spectrum-value.cc index 8ba0dae69..2a93bad26 100644 --- a/src/spectrum/model/spectrum-value.cc +++ b/src/spectrum/model/spectrum-value.cc @@ -405,7 +405,6 @@ operator << (std::ostream& os, const SpectrumValue& pvf) os << *it1 << " " ; ++it1; } - os << std::endl; return os; }