A Discrete-Event Network Simulator
API
radio-bearer-stats-calculator.cc
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 
23 #include "ns3/string.h"
24 #include "ns3/nstime.h"
25 #include <ns3/log.h>
26 #include <vector>
27 #include <algorithm>
28 
29 namespace ns3 {
30 
31 NS_LOG_COMPONENT_DEFINE ("RadioBearerStatsCalculator");
32 
33 NS_OBJECT_ENSURE_REGISTERED ( RadioBearerStatsCalculator);
34 
36  : m_firstWrite (true),
37  m_pendingOutput (false),
38  m_protocolType ("RLC")
39 {
40  NS_LOG_FUNCTION (this);
41 }
42 
44  : m_firstWrite (true),
45  m_pendingOutput (false)
46 {
47  NS_LOG_FUNCTION (this);
48  m_protocolType = protocolType;
49 }
50 
52 {
53  NS_LOG_FUNCTION (this);
54 }
55 
56 TypeId
58 {
59  static TypeId tid =
60  TypeId ("ns3::RadioBearerStatsCalculator")
61  .SetParent<LteStatsCalculator> ().AddConstructor<RadioBearerStatsCalculator> ()
62  .SetGroupName("Lte")
63  .AddAttribute ("StartTime", "Start time of the on going epoch.",
64  TimeValue (Seconds (0.)),
67  MakeTimeChecker ())
68  .AddAttribute ("EpochDuration", "Epoch duration.",
69  TimeValue (Seconds (0.25)),
72  MakeTimeChecker ())
73  .AddAttribute ("DlRlcOutputFilename",
74  "Name of the file where the downlink results will be saved.",
75  StringValue ("DlRlcStats.txt"),
78  .AddAttribute ("UlRlcOutputFilename",
79  "Name of the file where the uplink results will be saved.",
80  StringValue ("UlRlcStats.txt"),
83  .AddAttribute ("DlPdcpOutputFilename",
84  "Name of the file where the downlink results will be saved.",
85  StringValue ("DlPdcpStats.txt"),
88  .AddAttribute ("UlPdcpOutputFilename",
89  "Name of the file where the uplink results will be saved.",
90  StringValue ("UlPdcpStats.txt"),
93  ;
94  return tid;
95 }
96 
97 void
99 {
100  NS_LOG_FUNCTION (this);
101  if (m_pendingOutput)
102  {
103  ShowResults ();
104  }
105 }
106 
107 void
109 {
110  m_startTime = t;
112 }
113 
114 Time
116 {
117  return m_startTime;
118 }
119 
120 void
122 {
123  m_epochDuration = e;
125 }
126 
127 Time
129 {
130  return m_epochDuration;
131 }
132 
133 void
134 RadioBearerStatsCalculator::UlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
135 {
136  NS_LOG_FUNCTION (this << "UlTxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize);
137  ImsiLcidPair_t p (imsi, lcid);
138  if (Simulator::Now () >= m_startTime)
139  {
140  m_ulCellId[p] = cellId;
141  m_flowId[p] = LteFlowId_t (rnti, lcid);
142  m_ulTxPackets[p]++;
143  m_ulTxData[p] += packetSize;
144  }
145  m_pendingOutput = true;
146 }
147 
148 void
149 RadioBearerStatsCalculator::DlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
150 {
151  NS_LOG_FUNCTION (this << "DlTxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize);
152  ImsiLcidPair_t p (imsi, lcid);
153  if (Simulator::Now () >= m_startTime)
154  {
155  m_dlCellId[p] = cellId;
156  m_flowId[p] = LteFlowId_t (rnti, lcid);
157  m_dlTxPackets[p]++;
158  m_dlTxData[p] += packetSize;
159  }
160  m_pendingOutput = true;
161 }
162 
163 void
164 RadioBearerStatsCalculator::UlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize,
165  uint64_t delay)
166 {
167  NS_LOG_FUNCTION (this << "UlRxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize << delay);
168  ImsiLcidPair_t p (imsi, lcid);
169  if (Simulator::Now () >= m_startTime)
170  {
171  m_ulCellId[p] = cellId;
172  m_ulRxPackets[p]++;
173  m_ulRxData[p] += packetSize;
174 
175  Uint64StatsMap::iterator it = m_ulDelay.find (p);
176  if (it == m_ulDelay.end ())
177  {
178  NS_LOG_DEBUG (this << " Creating UL stats calculators for IMSI " << p.m_imsi << " and LCID " << (uint32_t) p.m_lcId);
179  m_ulDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
180  m_ulPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t> > ();
181  }
182  m_ulDelay[p]->Update (delay);
183  m_ulPduSize[p]->Update (packetSize);
184  }
185  m_pendingOutput = true;
186 }
187 
188 void
189 RadioBearerStatsCalculator::DlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
190 {
191  NS_LOG_FUNCTION (this << "DlRxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize << delay);
192  ImsiLcidPair_t p (imsi, lcid);
193  if (Simulator::Now () >= m_startTime)
194  {
195  m_dlCellId[p] = cellId;
196  m_dlRxPackets[p]++;
197  m_dlRxData[p] += packetSize;
198 
199  Uint64StatsMap::iterator it = m_dlDelay.find (p);
200  if (it == m_dlDelay.end ())
201  {
202  NS_LOG_DEBUG (this << " Creating DL stats calculators for IMSI " << p.m_imsi << " and LCID " << (uint32_t) p.m_lcId);
203  m_dlDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
204  m_dlPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t> > ();
205  }
206  m_dlDelay[p]->Update (delay);
207  m_dlPduSize[p]->Update (packetSize);
208  }
209  m_pendingOutput = true;
210 }
211 
212 void
214 {
215 
216  NS_LOG_FUNCTION (this << GetUlOutputFilename ().c_str () << GetDlOutputFilename ().c_str ());
217  NS_LOG_INFO ("Write Rlc Stats in " << GetUlOutputFilename ().c_str () << " and in " << GetDlOutputFilename ().c_str ());
218 
219  std::ofstream ulOutFile;
220  std::ofstream dlOutFile;
221 
222  if (m_firstWrite == true)
223  {
224  ulOutFile.open (GetUlOutputFilename ().c_str ());
225  if (!ulOutFile.is_open ())
226  {
227  NS_LOG_ERROR ("Can't open file " << GetUlOutputFilename ().c_str ());
228  return;
229  }
230 
231  dlOutFile.open (GetDlOutputFilename ().c_str ());
232  if (!dlOutFile.is_open ())
233  {
234  NS_LOG_ERROR ("Can't open file " << GetDlOutputFilename ().c_str ());
235  return;
236  }
237  m_firstWrite = false;
238  ulOutFile << "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
239  ulOutFile << "delay\tstdDev\tmin\tmax\t";
240  ulOutFile << "PduSize\tstdDev\tmin\tmax";
241  ulOutFile << std::endl;
242  dlOutFile << "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
243  dlOutFile << "delay\tstdDev\tmin\tmax\t";
244  dlOutFile << "PduSize\tstdDev\tmin\tmax";
245  dlOutFile << std::endl;
246  }
247  else
248  {
249  ulOutFile.open (GetUlOutputFilename ().c_str (), std::ios_base::app);
250  if (!ulOutFile.is_open ())
251  {
252  NS_LOG_ERROR ("Can't open file " << GetUlOutputFilename ().c_str ());
253  return;
254  }
255 
256  dlOutFile.open (GetDlOutputFilename ().c_str (), std::ios_base::app);
257  if (!dlOutFile.is_open ())
258  {
259  NS_LOG_ERROR ("Can't open file " << GetDlOutputFilename ().c_str ());
260  return;
261  }
262  }
263 
264  WriteUlResults (ulOutFile);
265  WriteDlResults (dlOutFile);
266  m_pendingOutput = false;
267 
268 }
269 
270 void
272 {
273  NS_LOG_FUNCTION (this);
274 
275  // Get the unique IMSI/LCID pairs list
276  std::vector < ImsiLcidPair_t > pairVector;
277  for (Uint32Map::iterator it = m_ulTxPackets.begin (); it != m_ulTxPackets.end (); ++it)
278  {
279  if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
280  {
281  pairVector.push_back ((*it).first);
282  }
283  }
284 
285  for (Uint32Map::iterator it = m_ulRxPackets.begin (); it != m_ulRxPackets.end (); ++it)
286  {
287  if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
288  {
289  pairVector.push_back ((*it).first);
290  }
291  }
292 
293  Time endTime = m_startTime + m_epochDuration;
294  for (std::vector<ImsiLcidPair_t>::iterator it = pairVector.begin (); it != pairVector.end (); ++it)
295  {
296  ImsiLcidPair_t p = *it;
297  outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
298  outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
299  outFile << GetUlCellId (p.m_imsi, p.m_lcId) << "\t";
300  outFile << p.m_imsi << "\t";
301  outFile << m_flowId[p].m_rnti << "\t";
302  outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
303  outFile << GetUlTxPackets (p.m_imsi, p.m_lcId) << "\t";
304  outFile << GetUlTxData (p.m_imsi, p.m_lcId) << "\t";
305  outFile << GetUlRxPackets (p.m_imsi, p.m_lcId) << "\t";
306  outFile << GetUlRxData (p.m_imsi, p.m_lcId) << "\t";
307  std::vector<double> stats = GetUlDelayStats (p.m_imsi, p.m_lcId);
308  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
309  {
310  outFile << (*it) * 1e-9 << "\t";
311  }
312  stats = GetUlPduSizeStats (p.m_imsi, p.m_lcId);
313  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
314  {
315  outFile << (*it) << "\t";
316  }
317  outFile << std::endl;
318  }
319 
320  outFile.close ();
321 }
322 
323 void
325 {
326  NS_LOG_FUNCTION (this);
327 
328  // Get the unique IMSI/LCID pairs list
329  std::vector < ImsiLcidPair_t > pairVector;
330  for (Uint32Map::iterator it = m_dlTxPackets.begin (); it != m_dlTxPackets.end (); ++it)
331  {
332  if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
333  {
334  pairVector.push_back ((*it).first);
335  }
336  }
337 
338  for (Uint32Map::iterator it = m_dlRxPackets.begin (); it != m_dlRxPackets.end (); ++it)
339  {
340  if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
341  {
342  pairVector.push_back ((*it).first);
343  }
344  }
345 
346  Time endTime = m_startTime + m_epochDuration;
347  for (std::vector<ImsiLcidPair_t>::iterator pair = pairVector.begin (); pair != pairVector.end (); ++pair)
348  {
349  ImsiLcidPair_t p = *pair;
350  outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
351  outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
352  outFile << GetDlCellId (p.m_imsi, p.m_lcId) << "\t";
353  outFile << p.m_imsi << "\t";
354  outFile << m_flowId[p].m_rnti << "\t";
355  outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
356  outFile << GetDlTxPackets (p.m_imsi, p.m_lcId) << "\t";
357  outFile << GetDlTxData (p.m_imsi, p.m_lcId) << "\t";
358  outFile << GetDlRxPackets (p.m_imsi, p.m_lcId) << "\t";
359  outFile << GetDlRxData (p.m_imsi, p.m_lcId) << "\t";
360  std::vector<double> stats = GetDlDelayStats (p.m_imsi, p.m_lcId);
361  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
362  {
363  outFile << (*it) * 1e-9 << "\t";
364  }
365  stats = GetDlPduSizeStats (p.m_imsi, p.m_lcId);
366  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
367  {
368  outFile << (*it) << "\t";
369  }
370  outFile << std::endl;
371  }
372 
373  outFile.close ();
374 }
375 
376 void
378 {
379  NS_LOG_FUNCTION (this);
380 
381  m_ulTxPackets.erase (m_ulTxPackets.begin (), m_ulTxPackets.end ());
382  m_ulRxPackets.erase (m_ulRxPackets.begin (), m_ulRxPackets.end ());
383  m_ulRxData.erase (m_ulRxData.begin (), m_ulRxData.end ());
384  m_ulTxData.erase (m_ulTxData.begin (), m_ulTxData.end ());
385  m_ulDelay.erase (m_ulDelay.begin (), m_ulDelay.end ());
386  m_ulPduSize.erase (m_ulPduSize.begin (), m_ulPduSize.end ());
387 
388  m_dlTxPackets.erase (m_dlTxPackets.begin (), m_dlTxPackets.end ());
389  m_dlRxPackets.erase (m_dlRxPackets.begin (), m_dlRxPackets.end ());
390  m_dlRxData.erase (m_dlRxData.begin (), m_dlRxData.end ());
391  m_dlTxData.erase (m_dlTxData.begin (), m_dlTxData.end ());
392  m_dlDelay.erase (m_dlDelay.begin (), m_dlDelay.end ());
393  m_dlPduSize.erase (m_dlPduSize.begin (), m_dlPduSize.end ());
394 }
395 
396 void
398 {
399  NS_LOG_FUNCTION (this);
401  NS_ASSERT (Simulator::Now ().GetMilliSeconds () == 0); // below event time assumes this
403 }
404 
405 void
407 {
408  NS_LOG_FUNCTION (this);
409  ShowResults ();
410  ResetResults ();
413 }
414 
415 uint32_t
416 RadioBearerStatsCalculator::GetUlTxPackets (uint64_t imsi, uint8_t lcid)
417 {
418  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
419  ImsiLcidPair_t p (imsi, lcid);
420  return m_ulTxPackets[p];
421 }
422 
423 uint32_t
424 RadioBearerStatsCalculator::GetUlRxPackets (uint64_t imsi, uint8_t lcid)
425 {
426  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
427  ImsiLcidPair_t p (imsi, lcid);
428  return m_ulRxPackets[p];
429 }
430 
431 uint64_t
432 RadioBearerStatsCalculator::GetUlTxData (uint64_t imsi, uint8_t lcid)
433 {
434  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
435  ImsiLcidPair_t p (imsi, lcid);
436  return m_ulTxData[p];
437 }
438 
439 uint64_t
440 RadioBearerStatsCalculator::GetUlRxData (uint64_t imsi, uint8_t lcid)
441 {
442  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
443  ImsiLcidPair_t p (imsi, lcid);
444  return m_ulRxData[p];
445 }
446 
447 double
448 RadioBearerStatsCalculator::GetUlDelay (uint64_t imsi, uint8_t lcid)
449 {
450  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
451  ImsiLcidPair_t p (imsi, lcid);
452  Uint64StatsMap::iterator it = m_ulDelay.find (p);
453  if (it == m_ulDelay.end ())
454  {
455  NS_LOG_ERROR ("UL delay for " << imsi << " - " << (uint16_t) lcid << " not found");
456  return 0;
457 
458  }
459  return m_ulDelay[p]->getMean ();
460 }
461 
462 std::vector<double>
463 RadioBearerStatsCalculator::GetUlDelayStats (uint64_t imsi, uint8_t lcid)
464 {
465  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
466  ImsiLcidPair_t p (imsi, lcid);
467  std::vector<double> stats;
468  Uint64StatsMap::iterator it = m_ulDelay.find (p);
469  if (it == m_ulDelay.end ())
470  {
471  stats.push_back (0.0);
472  stats.push_back (0.0);
473  stats.push_back (0.0);
474  stats.push_back (0.0);
475  return stats;
476 
477  }
478  stats.push_back (m_ulDelay[p]->getMean ());
479  stats.push_back (m_ulDelay[p]->getStddev ());
480  stats.push_back (m_ulDelay[p]->getMin ());
481  stats.push_back (m_ulDelay[p]->getMax ());
482  return stats;
483 }
484 
485 std::vector<double>
487 {
488  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
489  ImsiLcidPair_t p (imsi, lcid);
490  std::vector<double> stats;
491  Uint32StatsMap::iterator it = m_ulPduSize.find (p);
492  if (it == m_ulPduSize.end ())
493  {
494  stats.push_back (0.0);
495  stats.push_back (0.0);
496  stats.push_back (0.0);
497  stats.push_back (0.0);
498  return stats;
499 
500  }
501  stats.push_back (m_ulPduSize[p]->getMean ());
502  stats.push_back (m_ulPduSize[p]->getStddev ());
503  stats.push_back (m_ulPduSize[p]->getMin ());
504  stats.push_back (m_ulPduSize[p]->getMax ());
505  return stats;
506 }
507 
508 uint32_t
509 RadioBearerStatsCalculator::GetDlTxPackets (uint64_t imsi, uint8_t lcid)
510 {
511  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
512  ImsiLcidPair_t p (imsi, lcid);
513  return m_dlTxPackets[p];
514 }
515 
516 uint32_t
517 RadioBearerStatsCalculator::GetDlRxPackets (uint64_t imsi, uint8_t lcid)
518 {
519  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
520  ImsiLcidPair_t p (imsi, lcid);
521  return m_dlRxPackets[p];
522 }
523 
524 uint64_t
525 RadioBearerStatsCalculator::GetDlTxData (uint64_t imsi, uint8_t lcid)
526 {
527  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
528  ImsiLcidPair_t p (imsi, lcid);
529  return m_dlTxData[p];
530 }
531 
532 uint64_t
533 RadioBearerStatsCalculator::GetDlRxData (uint64_t imsi, uint8_t lcid)
534 {
535  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
536  ImsiLcidPair_t p (imsi, lcid);
537  return m_dlRxData[p];
538 }
539 
540 uint32_t
541 RadioBearerStatsCalculator::GetUlCellId (uint64_t imsi, uint8_t lcid)
542 {
543  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
544  ImsiLcidPair_t p (imsi, lcid);
545  return m_ulCellId[p];
546 }
547 
548 uint32_t
549 RadioBearerStatsCalculator::GetDlCellId (uint64_t imsi, uint8_t lcid)
550 {
551  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
552  ImsiLcidPair_t p (imsi, lcid);
553  return m_dlCellId[p];
554 }
555 
556 double
557 RadioBearerStatsCalculator::GetDlDelay (uint64_t imsi, uint8_t lcid)
558 {
559  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
560  ImsiLcidPair_t p (imsi, lcid);
561  Uint64StatsMap::iterator it = m_dlDelay.find (p);
562  if (it == m_dlDelay.end ())
563  {
564  NS_LOG_ERROR ("DL delay for " << imsi << " not found");
565  return 0;
566  }
567  return m_dlDelay[p]->getMean ();
568 }
569 
570 std::vector<double>
571 RadioBearerStatsCalculator::GetDlDelayStats (uint64_t imsi, uint8_t lcid)
572 {
573  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
574  ImsiLcidPair_t p (imsi, lcid);
575  std::vector<double> stats;
576  Uint64StatsMap::iterator it = m_dlDelay.find (p);
577  if (it == m_dlDelay.end ())
578  {
579  stats.push_back (0.0);
580  stats.push_back (0.0);
581  stats.push_back (0.0);
582  stats.push_back (0.0);
583  return stats;
584 
585  }
586  stats.push_back (m_dlDelay[p]->getMean ());
587  stats.push_back (m_dlDelay[p]->getStddev ());
588  stats.push_back (m_dlDelay[p]->getMin ());
589  stats.push_back (m_dlDelay[p]->getMax ());
590  return stats;
591 }
592 
593 std::vector<double>
595 {
596  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
597  ImsiLcidPair_t p (imsi, lcid);
598  std::vector<double> stats;
599  Uint32StatsMap::iterator it = m_dlPduSize.find (p);
600  if (it == m_dlPduSize.end ())
601  {
602  stats.push_back (0.0);
603  stats.push_back (0.0);
604  stats.push_back (0.0);
605  stats.push_back (0.0);
606  return stats;
607 
608  }
609  stats.push_back (m_dlPduSize[p]->getMean ());
610  stats.push_back (m_dlPduSize[p]->getStddev ());
611  stats.push_back (m_dlPduSize[p]->getMin ());
612  stats.push_back (m_dlPduSize[p]->getMax ());
613  return stats;
614 }
615 
616 std::string
618 {
619  if (m_protocolType == "RLC")
620  {
622  }
623  else
624  {
625  return GetUlPdcpOutputFilename ();
626  }
627 }
628 
629 std::string
631 {
632  if (m_protocolType == "RLC")
633  {
635  }
636  else
637  {
638  return GetDlPdcpOutputFilename ();
639  }
640 }
641 
642 void
644 {
645  m_ulPdcpOutputFilename = outputFilename;
646 }
647 
648 std::string
650 {
651  return m_ulPdcpOutputFilename;
652 }
653 void
655 {
656  m_dlPdcpOutputFilename = outputFilename;
657 }
658 
659 std::string
661 {
662  return m_dlPdcpOutputFilename;
663 }
664 
665 } // namespace ns3
Ptr< const AttributeChecker > MakeStringChecker(void)
Definition: string.cc:30
Base class for ***StatsCalculator classes.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual ~RadioBearerStatsCalculator()
Class destructor.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.
static TypeId GetTypeId(void)
Register this type.
Hold variables of type string.
Definition: string.h:41
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
Uint64Map m_dlRxData
Amount of DL RX Data by (IMSI, LCID) pair.
Uint32Map m_ulRxPackets
Number of UL RX Packets by (IMSI, LCID) pair.
Uint64Map m_ulRxData
Amount of UL RX Data by (IMSI, LCID) pair.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
uint32_t GetDlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received downlink data bytes.
FlowIdMap m_flowId
List of FlowIds, ie.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:277
Uint64Map m_ulTxData
Amount of UL TX Data by (IMSI, LCID) pair.
uint32_t GetUlCellId(uint64_t imsi, uint8_t lcid)
Gets the attached Enb cellId.
void WriteDlResults(std::ofstream &outFile)
Writes collected statistics to DL output file and closes DL output file.
Uint32Map m_dlRxPackets
Number of DL RX Packets by (IMSI, LCID) pair.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
void DoDispose()
Destructor implementation.
uint32_t GetUlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink packets.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1375
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
std::vector< double > GetUlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the uplink PDU size statistics: average, min, max and standard deviation.
AttributeValue implementation for Time.
Definition: nstime.h:1069
ImsiLcidPair structure.
Definition: lte-common.h:56
void WriteUlResults(std::ofstream &outFile)
Writes collected statistics to UL output file and closes UL output file.
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.
Uint32Map m_dlTxPackets
Number of DL TX Packets by (IMSI, LCID) pair.
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.
Uint64Map m_dlTxData
Amount of DL TX Data by (IMSI, LCID) pair.
Uint32Map m_ulTxPackets
Number of UL TX Packets by (IMSI, LCID) pair.
std::string GetDlPdcpOutputFilename(void)
Get the name of the file where the downlink PDCP statistics will be stored.
Uint64StatsMap m_ulDelay
UL delay by (IMSI, LCID) pair.
EventId m_endEpochEvent
Event id for next end epoch event.
uint32_t GetUlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received uplink packets.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Uint64StatsMap m_dlDelay
DL delay by (IMSI, LCID) pair.
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
void SetDlOutputFilename(std::string outputFilename)
Set the name of the file where the downlink statistics will be stored.
bool m_firstWrite
true if output files have not been opened yet
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: nstime.h:1070
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
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.
void ResetResults(void)
Erases collected statistics.
Uint32StatsMap m_ulPduSize
UL PDU Size by (IMSI, LCID) pair.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:367
std::string m_protocolType
Protocol type, by default RLC.
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.
uint32_t GetDlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted downlink data bytes.
LteFlowId structure.
Definition: lte-common.h:36
uint64_t m_imsi
IMSI.
Definition: lte-common.h:58
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
void ShowResults(void)
Called after each epoch to write collected statistics to output files.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1007
void RescheduleEndEpoch()
Reschedules EndEpoch event.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
void SetDlPdcpOutputFilename(std::string outputFilename)
Set the name of the file where the downlink PDCP statistics will be stored.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:253
static const uint32_t packetSize
Uint32Map m_dlCellId
List of DL CellIds by (IMSI, LCID) pair.
void EndEpoch(void)
Function called in every endEpochEvent.
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: string.h:42
uint8_t m_lcId
LCID.
Definition: lte-common.h:59
std::vector< double > GetUlDelayStats(uint64_t imsi, uint8_t lcid)
Gets the uplink RLC to RLC statistics: average, min, max and standard deviation.
std::vector< double > GetDlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the downlink PDU size statistics: average, min, max and standard deviation.
std::string m_ulPdcpOutputFilename
Name of the file where the uplink PDCP statistics will be saved.
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
Uint32StatsMap m_dlPduSize
DL PDU Size by (IMSI, LCID) pair.
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.
Uint32Map m_ulCellId
List of UL CellIds by (IMSI, LCID) pair.
std::string m_dlPdcpOutputFilename
Name of the file where the downlink PDCP statistics will be saved.
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.