add new file for lte common stuff
This commit is contained in:
@@ -51,7 +51,7 @@ int main (int argc, char *argv[])
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
// Enable LTE log components
|
||||
//lena.EnableLogComponents ();
|
||||
lena.EnableLogComponents ();
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
|
||||
@@ -67,7 +67,7 @@ void
|
||||
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 @@ void
|
||||
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 @@ RlcStatsCalculator::ShowResults (void)
|
||||
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 @@ RlcStatsCalculator::ShowResults (void)
|
||||
}
|
||||
|
||||
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 @@ RlcStatsCalculator::GetDelay (RntiLcidPair p)
|
||||
}
|
||||
|
||||
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 @@ RlcStatsCalculator::GetThroughput (RntiLcidPair p)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,40 +24,18 @@
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/basic-data-calculators.h"
|
||||
#include "ns3/lte-common.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
struct RntiLcidPair
|
||||
{
|
||||
uint16_t rnti;
|
||||
uint8_t lcid;
|
||||
typedef std::map<lteFlowId_t, uint32_t> uint32Map;
|
||||
typedef std::map<lteFlowId_t, uint64_t> uint64Map;
|
||||
typedef std::map<lteFlowId_t, Ptr<MinMaxAvgTotalCalculator<uint64_t> > > uint64StatsMap;
|
||||
|
||||
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<RntiLcidPair, uint32_t> uint32Map;
|
||||
typedef std::map<RntiLcidPair, uint64_t> uint64Map;
|
||||
typedef std::map<RntiLcidPair, Ptr<MinMaxAvgTotalCalculator<uint64_t> > > uint64StatsMap;
|
||||
// TODO: Really useful? Maybe to remove
|
||||
// typedef std::pair<RntiLcidPair, std::string> uint32Pair;
|
||||
// typedef std::pair<RntiLcidPair, uint64_t> uint64Pair;
|
||||
// typedef std::pair<RntiLcidPair, Ptr<MinMaxAvgTotalCalculator<uint64_t> > > uint64StatsPair;
|
||||
|
||||
class RlcStatsCalculator : public Object
|
||||
{
|
||||
@@ -72,11 +50,11 @@ public:
|
||||
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);
|
||||
|
||||
51
src/lte/model/lte-common.cc
Normal file
51
src/lte/model/lte-common.cc
Normal file
@@ -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 <manuel.requena@cttc.es>
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
45
src/lte/model/lte-common.h
Normal file
45
src/lte/model/lte-common.h
Normal file
@@ -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 <manuel.requena@cttc.es>
|
||||
*/
|
||||
#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_ */
|
||||
@@ -4,6 +4,7 @@ def build(bld):
|
||||
|
||||
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 @@ def build(bld):
|
||||
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',
|
||||
|
||||
Reference in New Issue
Block a user