A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
radio-bearer-stats-calculator.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Jaume Nin <jnin@cttc.es>
19  * Nicola Baldo <nbaldo@cttc.es>
20  */
21 
22 #ifndef RADIO_BEARER_STATS_CALCULATOR_H_
23 #define RADIO_BEARER_STATS_CALCULATOR_H_
24 
25 #include "ns3/lte-stats-calculator.h"
26 #include "ns3/lte-common.h"
27 #include "ns3/uinteger.h"
28 #include "ns3/object.h"
29 #include "ns3/basic-data-calculators.h"
30 #include "ns3/lte-common.h"
31 #include <string>
32 #include <map>
33 #include <fstream>
34 
35 namespace ns3
36 {
37 
38 typedef std::map<ImsiLcidPair_t, uint32_t> Uint32Map;
39 typedef std::map<ImsiLcidPair_t, uint64_t> Uint64Map;
40 typedef std::map<ImsiLcidPair_t, Ptr<MinMaxAvgTotalCalculator<uint32_t> > > Uint32StatsMap;
41 typedef std::map<ImsiLcidPair_t, Ptr<MinMaxAvgTotalCalculator<uint64_t> > > Uint64StatsMap;
42 typedef std::map<ImsiLcidPair_t, double> DoubleMap;
43 typedef std::map<ImsiLcidPair_t, LteFlowId_t> FlowIdMap;
44 
64 {
65 public:
70 
74  RadioBearerStatsCalculator (std::string protocolType);
75 
79  virtual
81 
82  // Inherited from ns3::Object
83  static TypeId GetTypeId (void);
84  void DoDispose ();
85 
90  std::string GetUlOutputFilename (void);
91 
96  std::string GetDlOutputFilename (void);
97 
103  void SetUlPdcpOutputFilename (std::string outputFilename);
104 
109  std::string GetUlPdcpOutputFilename (void);
110 
116  void SetDlPdcpOutputFilename (std::string outputFilename);
117 
122  std::string GetDlPdcpOutputFilename (void);
123 
124 
129  void SetStartTime (Time t);
130 
135  Time GetStartTime () const;
136 
141  void SetEpoch (Time e);
142 
147  Time GetEpoch () const;
148 
157  void
158  UlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize);
159 
169  void
170  UlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay);
171 
180  void
181  DlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize);
182 
192  void
193  DlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay);
194 
201  uint32_t
202  GetUlTxPackets (uint64_t imsi, uint8_t lcid);
203 
210  uint32_t
211  GetUlRxPackets (uint64_t imsi, uint8_t lcid);
212 
219  uint64_t
220  GetUlTxData (uint64_t imsi, uint8_t lcid);
221 
228  uint64_t
229  GetUlRxData (uint64_t imsi, uint8_t lcid);
230 
237  uint32_t
238  GetUlCellId (uint64_t imsi, uint8_t lcid);
239 
246  double
247  GetUlDelay (uint64_t imsi, uint8_t lcid);
248 
255  std::vector<double>
256  GetUlDelayStats (uint64_t imsi, uint8_t lcid);
257 
264  std::vector<double>
265  GetUlPduSizeStats (uint64_t imsi, uint8_t lcid);
266 
273  uint32_t
274  GetDlTxPackets (uint64_t imsi, uint8_t lcid);
275 
282  uint32_t
283  GetDlRxPackets (uint64_t imsi, uint8_t lcid);
284 
291  uint64_t
292  GetDlTxData (uint64_t imsi, uint8_t lcid);
293 
300  uint64_t
301  GetDlRxData (uint64_t imsi, uint8_t lcid);
302 
309  uint32_t
310  GetDlCellId (uint64_t imsi, uint8_t lcid);
311 
318  double
319  GetDlDelay (uint64_t imsi, uint8_t lcid);
320 
327  std::vector<double>
328  GetDlDelayStats (uint64_t imsi, uint8_t lcid);
329 
336  std::vector<double>
337  GetDlPduSizeStats (uint64_t imsi, uint8_t lcid);
338 
339 private:
340  void
341  ShowResults (void);
342  void
343  WriteUlResults (std::ofstream& outFile);
344  void
345  WriteDlResults (std::ofstream& outFile);
346  void
347  ResetResults (void);
348 
349  void RescheduleEndEpoch ();
350 
351  void EndEpoch (void);
352 
354 
356 
364 
372 
377 
382 
387 
392  std::string m_protocolType;
393 
396 
397 };
398 
399 } // namespace ns3
400 
401 #endif /* RADIO_BEARER_STATS_CALCULATOR_H_ */
Doxygen introspection did not find any typical Config paths.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
std::map< ImsiLcidPair_t, uint32_t > Uint32Map
std::map< ImsiLcidPair_t, uint64_t > Uint64Map
virtual ~RadioBearerStatsCalculator()
Class destructor.
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.
double GetUlDelay(uint64_t imsi, uint8_t lcid)
Gets the uplink RLC to RLC delay.
std::string GetUlPdcpOutputFilename(void)
Get the name of the file where the uplink PDCP statistics will be stored.
bool m_pendingOutput
true if any output is pending
uint32_t GetDlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received downlink data bytes.
uint32_t GetUlCellId(uint64_t imsi, uint8_t lcid)
Gets the attached Enb cellId.
void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
uint32_t GetUlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink packets.
std::vector< double > GetUlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the uplink PDU size statistics: average, min, max and standard deviation.
uint64_t GetDlRxData(uint64_t imsi, uint8_t lcid)
Gets the number of received downlink data bytes.
void SetUlPdcpOutputFilename(std::string outputFilename)
Set the name of the file where the uplink PDCP statistics will be stored.
double GetDlDelay(uint64_t imsi, uint8_t lcid)
Gets the downlink RLC to RLC delay.
std::map< ImsiLcidPair_t, Ptr< MinMaxAvgTotalCalculator< uint32_t > > > Uint32StatsMap
void UlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
Notifies the stats calculator that an uplink transmission has occurred.
std::string GetDlPdcpOutputFilename(void)
Get the name of the file where the downlink PDCP statistics will be stored.
uint32_t GetUlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received uplink packets.
std::map< ImsiLcidPair_t, Ptr< MinMaxAvgTotalCalculator< uint64_t > > > Uint64StatsMap
Time m_startTime
Start time of the on going epoch.
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
bool m_firstWrite
true if output files have not been opened yet
uint64_t GetDlTxData(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted downlink data bytes.
void DlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
Notifies the stats calculator that an downlink transmission has occurred.
uint32_t GetDlCellId(uint64_t imsi, uint8_t lcid)
Gets the attached Enb cellId.
void UlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
Notifies the stats calculator that an uplink reception has occurred.
uint64_t GetUlTxData(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink data bytes.
uint64_t GetUlRxData(uint64_t imsi, uint8_t lcid)
Gets the number of received uplink data bytes.
std::vector< double > GetDlDelayStats(uint64_t imsi, uint8_t lcid)
Gets the downlink RLC to RLC statistics: average, min, max and standard deviation.
an identifier for simulation events.
Definition: event-id.h:46
uint32_t GetDlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted downlink data bytes.
void SetDlPdcpOutputFilename(std::string outputFilename)
Set the name of the file where the downlink PDCP statistics will be stored.
std::map< ImsiLcidPair_t, LteFlowId_t > FlowIdMap
std::vector< double > GetUlDelayStats(uint64_t imsi, uint8_t lcid)
Gets the uplink RLC to RLC statistics: average, min, max and standard deviation.
This class is an ns-3 trace sink that performs the calculation of PDU statistics for uplink and downl...
std::vector< double > GetDlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the downlink PDU size statistics: average, min, max and standard deviation.
a unique identifier for an interface.
Definition: type-id.h:49
void DlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
Notifies the stats calculator that an downlink reception has occurred.
std::map< ImsiLcidPair_t, double > DoubleMap