# HG changeset patch # User mrequena # Date 1301649168 -7200 # Node ID 7c5f7e3b405466160496ddfc635797e60aa245e9 # Parent 986b8e0fd32decf6726d31ee2e4ea832965eb2d6 add new file for lte common stuff diff -r 986b8e0fd32d -r 7c5f7e3b4054 src/lte/examples/lena-rlc-calculator.cc --- a/src/lte/examples/lena-rlc-calculator.cc Thu Mar 31 16:26:03 2011 +0200 +++ b/src/lte/examples/lena-rlc-calculator.cc Fri Apr 01 11:12:48 2011 +0200 @@ -51,7 +51,7 @@ cmd.Parse (argc, argv); // Enable LTE log components - //lena.EnableLogComponents (); + lena.EnableLogComponents (); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff -r 986b8e0fd32d -r 7c5f7e3b4054 src/lte/helper/rlc-stats-calculator.cc --- a/src/lte/helper/rlc-stats-calculator.cc Thu Mar 31 16:26:03 2011 +0200 +++ b/src/lte/helper/rlc-stats-calculator.cc Fri Apr 01 11:12:48 2011 +0200 @@ -67,7 +67,7 @@ RlcStatsCalculator::TxPdu (uint16_t rnti, uint8_t lcid, uint32_t packetSize) { NS_LOG_FUNCTION (this << "TxPDU" << rnti << (uint32_t) lcid << packetSize); - RntiLcidPair pair = RntiLcidPair(rnti, lcid); + lteFlowId_t pair = lteFlowId_t(rnti, lcid); m_txPackets[pair]++; } @@ -76,7 +76,7 @@ RlcStatsCalculator::RxPdu (uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) { NS_LOG_FUNCTION (this << "RxPDU" << rnti << (uint32_t) lcid << packetSize << delay); - RntiLcidPair pair = RntiLcidPair(rnti, lcid); + lteFlowId_t pair = lteFlowId_t(rnti, lcid); m_rxPackets [pair]++; m_rxData [pair] += packetSize; @@ -110,32 +110,32 @@ m_outFile << "# Parameter, RNTI, LCID, value" << std::endl; for ( it = m_txPackets.begin(); it != m_txPackets.end(); ++it) { - m_outFile << "TxPackets, " << (*it).first.rnti << ", " - << (uint32_t) (*it).first.lcid << ", " + m_outFile << "TxPackets, " << (*it).first.m_rnti << ", " + << (uint32_t) (*it).first.m_lcId << ", " << (*it).second << std::endl; } for ( it = m_rxPackets.begin(); it != m_rxPackets.end(); ++it) { - m_outFile << "RxPackets, " << (*it).first.rnti << ", " - << (uint32_t) (*it).first.lcid << ", " + m_outFile << "RxPackets, " << (*it).first.m_rnti << ", " + << (uint32_t) (*it).first.m_lcId << ", " << (*it).second << std::endl; } for ( itData = m_rxData.begin(); itData != m_rxData.end(); ++itData) { - m_outFile << "RxData, " << (*itData).first.rnti << ", " - << (uint32_t) (*itData).first.lcid << ", " + m_outFile << "RxData, " << (*itData).first.m_rnti << ", " + << (uint32_t) (*itData).first.m_lcId << ", " << (*itData).second << std::endl; } for ( itData = m_rxData.begin(); itData != m_rxData.end(); ++itData) { - m_outFile << "Throughput, " << (*itData).first.rnti << ", " - << (uint32_t) (*itData).first.lcid << ", " + m_outFile << "Throughput, " << (*itData).first.m_rnti << ", " + << (uint32_t) (*itData).first.m_lcId << ", " << GetThroughput ((*itData).first) << std::endl; } for ( itDelay = m_delay.begin (); itDelay != m_delay.end (); ++itDelay) { - m_outFile << "Delay, " << (*itDelay).first.rnti << ", " - << (uint32_t) (*itDelay).first.lcid << ", " + m_outFile << "Delay, " << (*itDelay).first.m_rnti << ", " + << (uint32_t) (*itDelay).first.m_lcId << ", " << GetDelay ((*itDelay).first) << std::endl; } @@ -143,25 +143,25 @@ } uint32_t -RlcStatsCalculator::GetTxPackets (RntiLcidPair p) +RlcStatsCalculator::GetTxPackets (lteFlowId_t p) { return m_txPackets[p]; } uint32_t -RlcStatsCalculator::GetRxPackets (RntiLcidPair p) +RlcStatsCalculator::GetRxPackets (lteFlowId_t p) { return m_rxPackets[p]; } uint64_t -RlcStatsCalculator::GetRxData (RntiLcidPair p) +RlcStatsCalculator::GetRxData (lteFlowId_t p) { return m_rxData[p]; } uint64_t -RlcStatsCalculator::GetDelay (RntiLcidPair p) +RlcStatsCalculator::GetDelay (lteFlowId_t p) { uint64StatsMap::iterator it = m_delay.find (p); if ( it == m_delay.end () ) @@ -172,7 +172,7 @@ } double -RlcStatsCalculator::GetThroughput (RntiLcidPair p) +RlcStatsCalculator::GetThroughput (lteFlowId_t p) { // TODO: Fix throughput calculation with the correct time // NOTE: At this moment, Simulator::Now() is not available anymore @@ -183,35 +183,35 @@ uint32_t RlcStatsCalculator::GetTxPackets (uint16_t rnti, uint8_t lcid) { - RntiLcidPair p = RntiLcidPair (rnti, lcid); + lteFlowId_t p = lteFlowId_t (rnti, lcid); return GetTxPackets(p); } uint32_t RlcStatsCalculator::GetRxPackets (uint16_t rnti, uint8_t lcid) { - RntiLcidPair p = RntiLcidPair (rnti, lcid); + lteFlowId_t p = lteFlowId_t (rnti, lcid); return GetRxPackets(p); } uint64_t RlcStatsCalculator::GetRxData (uint16_t rnti, uint8_t lcid) { - RntiLcidPair p = RntiLcidPair (rnti, lcid); + lteFlowId_t p = lteFlowId_t (rnti, lcid); return GetRxData(p); } uint64_t RlcStatsCalculator::GetDelay (uint16_t rnti, uint8_t lcid) { - RntiLcidPair p = RntiLcidPair (rnti, lcid); + lteFlowId_t p = lteFlowId_t (rnti, lcid); return GetDelay(p); } double RlcStatsCalculator::GetThroughput (uint16_t rnti, uint8_t lcid) { - RntiLcidPair p = RntiLcidPair (rnti, lcid); + lteFlowId_t p = lteFlowId_t (rnti, lcid); return GetThroughput(p); } diff -r 986b8e0fd32d -r 7c5f7e3b4054 src/lte/helper/rlc-stats-calculator.h --- a/src/lte/helper/rlc-stats-calculator.h Thu Mar 31 16:26:03 2011 +0200 +++ b/src/lte/helper/rlc-stats-calculator.h Fri Apr 01 11:12:48 2011 +0200 @@ -24,40 +24,18 @@ #include "ns3/uinteger.h" #include "ns3/object.h" #include "ns3/basic-data-calculators.h" +#include "ns3/lte-common.h" #include #include #include - namespace ns3 { - -struct RntiLcidPair - { - uint16_t rnti; - uint8_t lcid; - - RntiLcidPair (const uint16_t a, const uint8_t b) : - rnti(a), - lcid(b) - { } + - friend bool operator == (const RntiLcidPair &a, const RntiLcidPair &b) - { - return ( (a.rnti == b.rnti) && (a.lcid == b.lcid) ); - } - friend bool operator < (const RntiLcidPair &a, const RntiLcidPair &b) - { - return ( (a.rnti < b.rnti) || ( (a.rnti == b.rnti) && (a.lcid < b.lcid) ) ); - } - }; +typedef std::map uint32Map; +typedef std::map uint64Map; +typedef std::map > > uint64StatsMap; -typedef std::map uint32Map; -typedef std::map uint64Map; -typedef std::map > > uint64StatsMap; -// TODO: Really useful? Maybe to remove -// typedef std::pair uint32Pair; -// typedef std::pair uint64Pair; -// typedef std::pair > > uint64StatsPair; class RlcStatsCalculator : public Object { @@ -72,11 +50,11 @@ void TxPdu (uint16_t rnti, uint8_t lcid, uint32_t packetSize); void RxPdu (uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay); - uint32_t GetTxPackets (RntiLcidPair p); - uint32_t GetRxPackets (RntiLcidPair p); - uint64_t GetRxData (RntiLcidPair p); - uint64_t GetDelay (RntiLcidPair p); - double GetThroughput (RntiLcidPair p); + uint32_t GetTxPackets (lteFlowId_t p); + uint32_t GetRxPackets (lteFlowId_t p); + uint64_t GetRxData (lteFlowId_t p); + uint64_t GetDelay (lteFlowId_t p); + double GetThroughput (lteFlowId_t p); uint32_t GetTxPackets (uint16_t rnti, uint8_t lcid); uint32_t GetRxPackets (uint16_t rnti, uint8_t lcid); diff -r 986b8e0fd32d -r 7c5f7e3b4054 src/lte/model/lte-common.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lte/model/lte-common.cc Fri Apr 01 11:12:48 2011 +0200 @@ -0,0 +1,51 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * 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: Manuel Requena + */ + +#include "lte-common.h" + + +namespace ns3 { + + +lteFlowId_t::lteFlowId_t () +{ +} + +lteFlowId_t::lteFlowId_t (const uint16_t a, const uint8_t b) + : m_rnti(a), + m_lcId(b) +{ +} + +bool +operator == (const lteFlowId_t &a, const lteFlowId_t &b) +{ + return ( (a.m_rnti == b.m_rnti) && (a.m_lcId == b.m_lcId) ); +} + +bool +operator < (const lteFlowId_t& a, const lteFlowId_t& b) +{ + return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_lcId < b.m_lcId) ) ); +} + + +}; // namespace ns3 + diff -r 986b8e0fd32d -r 7c5f7e3b4054 src/lte/model/lte-common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lte/model/lte-common.h Fri Apr 01 11:12:48 2011 +0200 @@ -0,0 +1,45 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * 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: Manuel Requena + */ +#ifndef LTE_COMMON_H +#define LTE_COMMON_H + +#include "ns3/uinteger.h" + +namespace ns3 { + + +struct lteFlowId_t +{ + uint16_t m_rnti; + uint8_t m_lcId; + +public: + lteFlowId_t (); + lteFlowId_t (const uint16_t a, const uint8_t b); + + friend bool operator == (const lteFlowId_t &a, const lteFlowId_t &b); + friend bool operator < (const lteFlowId_t &a, const lteFlowId_t &b); +}; + + +}; // namespace ns3 + + +#endif /* LTE_COMMON_H_ */ diff -r 986b8e0fd32d -r 7c5f7e3b4054 src/lte/wscript --- a/src/lte/wscript Thu Mar 31 16:26:03 2011 +0200 +++ b/src/lte/wscript Fri Apr 01 11:12:48 2011 +0200 @@ -4,6 +4,7 @@ module = bld.create_ns3_module('lte', ['core', 'network', 'spectrum', 'stats']) module.source = [ + 'model/lte-common.cc', 'model/lte-spectrum-phy.cc', 'model/lte-phy.cc', 'model/lte-enb-phy.cc', @@ -49,6 +50,7 @@ headers = bld.new_task_gen('ns3header') headers.module = 'lte' headers.source = [ + 'model/lte-common.h', 'model/lte-spectrum-phy.h', 'model/lte-phy.h', 'model/lte-enb-phy.h',