diff --git a/src/lte/examples/lena-rlc-calculator.cc b/src/lte/examples/lena-rlc-calculator.cc index 5a5321a89..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; @@ -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 (); 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; 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; }