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 list
276 
277  std::vector < ImsiLcidPair_t > pairVector;
278  for (Uint32Map::iterator it = m_ulTxPackets.begin (); it != m_ulTxPackets.end (); ++it)
279  {
280  if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
281  {
282  pairVector.push_back ((*it).first);
283  }
284  }
285 
286  Time endTime = m_startTime + m_epochDuration;
287  for (std::vector<ImsiLcidPair_t>::iterator it = pairVector.begin (); it != pairVector.end (); ++it)
288  {
289  ImsiLcidPair_t p = *it;
290  outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
291  outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
292  outFile << GetUlCellId (p.m_imsi, p.m_lcId) << "\t";
293  outFile << p.m_imsi << "\t";
294  outFile << m_flowId[p].m_rnti << "\t";
295  outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
296  outFile << GetUlTxPackets (p.m_imsi, p.m_lcId) << "\t";
297  outFile << GetUlTxData (p.m_imsi, p.m_lcId) << "\t";
298  outFile << GetUlRxPackets (p.m_imsi, p.m_lcId) << "\t";
299  outFile << GetUlRxData (p.m_imsi, p.m_lcId) << "\t";
300  std::vector<double> stats = GetUlDelayStats (p.m_imsi, p.m_lcId);
301  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
302  {
303  outFile << (*it) * 1e-9 << "\t";
304  }
305  stats = GetUlPduSizeStats (p.m_imsi, p.m_lcId);
306  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
307  {
308  outFile << (*it) << "\t";
309  }
310  outFile << std::endl;
311  }
312 
313  outFile.close ();
314 }
315 
316 void
318 {
319  NS_LOG_FUNCTION (this);
320 
321  // Get the unique IMSI list
322  std::vector < ImsiLcidPair_t > pairVector;
323  for (Uint32Map::iterator it = m_dlTxPackets.begin (); it != m_dlTxPackets.end (); ++it)
324  {
325  if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
326  {
327  pairVector.push_back ((*it).first);
328  }
329  }
330 
331  Time endTime = m_startTime + m_epochDuration;
332  for (std::vector<ImsiLcidPair_t>::iterator pair = pairVector.begin (); pair != pairVector.end (); ++pair)
333  {
334  ImsiLcidPair_t p = *pair;
335  outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
336  outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
337  outFile << GetDlCellId (p.m_imsi, p.m_lcId) << "\t";
338  outFile << p.m_imsi << "\t";
339  outFile << m_flowId[p].m_rnti << "\t";
340  outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
341  outFile << GetDlTxPackets (p.m_imsi, p.m_lcId) << "\t";
342  outFile << GetDlTxData (p.m_imsi, p.m_lcId) << "\t";
343  outFile << GetDlRxPackets (p.m_imsi, p.m_lcId) << "\t";
344  outFile << GetDlRxData (p.m_imsi, p.m_lcId) << "\t";
345  std::vector<double> stats = GetDlDelayStats (p.m_imsi, p.m_lcId);
346  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
347  {
348  outFile << (*it) * 1e-9 << "\t";
349  }
350  stats = GetDlPduSizeStats (p.m_imsi, p.m_lcId);
351  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
352  {
353  outFile << (*it) << "\t";
354  }
355  outFile << std::endl;
356  }
357 
358  outFile.close ();
359 }
360 
361 void
363 {
364  NS_LOG_FUNCTION (this);
365 
366  m_ulTxPackets.erase (m_ulTxPackets.begin (), m_ulTxPackets.end ());
367  m_ulRxPackets.erase (m_ulRxPackets.begin (), m_ulRxPackets.end ());
368  m_ulRxData.erase (m_ulRxData.begin (), m_ulRxData.end ());
369  m_ulTxData.erase (m_ulTxData.begin (), m_ulTxData.end ());
370  m_ulDelay.erase (m_ulDelay.begin (), m_ulDelay.end ());
371  m_ulPduSize.erase (m_ulPduSize.begin (), m_ulPduSize.end ());
372 
373  m_dlTxPackets.erase (m_dlTxPackets.begin (), m_dlTxPackets.end ());
374  m_dlRxPackets.erase (m_dlRxPackets.begin (), m_dlRxPackets.end ());
375  m_dlRxData.erase (m_dlRxData.begin (), m_dlRxData.end ());
376  m_dlTxData.erase (m_dlTxData.begin (), m_dlTxData.end ());
377  m_dlDelay.erase (m_dlDelay.begin (), m_dlDelay.end ());
378  m_dlPduSize.erase (m_dlPduSize.begin (), m_dlPduSize.end ());
379 }
380 
381 void
383 {
384  NS_LOG_FUNCTION (this);
386  NS_ASSERT (Simulator::Now ().GetMilliSeconds () == 0); // below event time assumes this
388 }
389 
390 void
392 {
393  NS_LOG_FUNCTION (this);
394  ShowResults ();
395  ResetResults ();
398 }
399 
400 uint32_t
401 RadioBearerStatsCalculator::GetUlTxPackets (uint64_t imsi, uint8_t lcid)
402 {
403  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
404  ImsiLcidPair_t p (imsi, lcid);
405  return m_ulTxPackets[p];
406 }
407 
408 uint32_t
409 RadioBearerStatsCalculator::GetUlRxPackets (uint64_t imsi, uint8_t lcid)
410 {
411  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
412  ImsiLcidPair_t p (imsi, lcid);
413  return m_ulRxPackets[p];
414 }
415 
416 uint64_t
417 RadioBearerStatsCalculator::GetUlTxData (uint64_t imsi, uint8_t lcid)
418 {
419  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
420  ImsiLcidPair_t p (imsi, lcid);
421  return m_ulTxData[p];
422 }
423 
424 uint64_t
425 RadioBearerStatsCalculator::GetUlRxData (uint64_t imsi, uint8_t lcid)
426 {
427  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
428  ImsiLcidPair_t p (imsi, lcid);
429  return m_ulRxData[p];
430 }
431 
432 double
433 RadioBearerStatsCalculator::GetUlDelay (uint64_t imsi, uint8_t lcid)
434 {
435  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
436  ImsiLcidPair_t p (imsi, lcid);
437  Uint64StatsMap::iterator it = m_ulDelay.find (p);
438  if (it == m_ulDelay.end ())
439  {
440  NS_LOG_ERROR ("UL delay for " << imsi << " - " << (uint16_t) lcid << " not found");
441  return 0;
442 
443  }
444  return m_ulDelay[p]->getMean ();
445 }
446 
447 std::vector<double>
448 RadioBearerStatsCalculator::GetUlDelayStats (uint64_t imsi, uint8_t lcid)
449 {
450  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
451  ImsiLcidPair_t p (imsi, lcid);
452  std::vector<double> stats;
453  Uint64StatsMap::iterator it = m_ulDelay.find (p);
454  if (it == m_ulDelay.end ())
455  {
456  stats.push_back (0.0);
457  stats.push_back (0.0);
458  stats.push_back (0.0);
459  stats.push_back (0.0);
460  return stats;
461 
462  }
463  stats.push_back (m_ulDelay[p]->getMean ());
464  stats.push_back (m_ulDelay[p]->getStddev ());
465  stats.push_back (m_ulDelay[p]->getMin ());
466  stats.push_back (m_ulDelay[p]->getMax ());
467  return stats;
468 }
469 
470 std::vector<double>
472 {
473  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
474  ImsiLcidPair_t p (imsi, lcid);
475  std::vector<double> stats;
476  Uint32StatsMap::iterator it = m_ulPduSize.find (p);
477  if (it == m_ulPduSize.end ())
478  {
479  stats.push_back (0.0);
480  stats.push_back (0.0);
481  stats.push_back (0.0);
482  stats.push_back (0.0);
483  return stats;
484 
485  }
486  stats.push_back (m_ulPduSize[p]->getMean ());
487  stats.push_back (m_ulPduSize[p]->getStddev ());
488  stats.push_back (m_ulPduSize[p]->getMin ());
489  stats.push_back (m_ulPduSize[p]->getMax ());
490  return stats;
491 }
492 
493 uint32_t
494 RadioBearerStatsCalculator::GetDlTxPackets (uint64_t imsi, uint8_t lcid)
495 {
496  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
497  ImsiLcidPair_t p (imsi, lcid);
498  return m_dlTxPackets[p];
499 }
500 
501 uint32_t
502 RadioBearerStatsCalculator::GetDlRxPackets (uint64_t imsi, uint8_t lcid)
503 {
504  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
505  ImsiLcidPair_t p (imsi, lcid);
506  return m_dlRxPackets[p];
507 }
508 
509 uint64_t
510 RadioBearerStatsCalculator::GetDlTxData (uint64_t imsi, uint8_t lcid)
511 {
512  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
513  ImsiLcidPair_t p (imsi, lcid);
514  return m_dlTxData[p];
515 }
516 
517 uint64_t
518 RadioBearerStatsCalculator::GetDlRxData (uint64_t imsi, uint8_t lcid)
519 {
520  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
521  ImsiLcidPair_t p (imsi, lcid);
522  return m_dlRxData[p];
523 }
524 
525 uint32_t
526 RadioBearerStatsCalculator::GetUlCellId (uint64_t imsi, uint8_t lcid)
527 {
528  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
529  ImsiLcidPair_t p (imsi, lcid);
530  return m_ulCellId[p];
531 }
532 
533 uint32_t
534 RadioBearerStatsCalculator::GetDlCellId (uint64_t imsi, uint8_t lcid)
535 {
536  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
537  ImsiLcidPair_t p (imsi, lcid);
538  return m_dlCellId[p];
539 }
540 
541 double
542 RadioBearerStatsCalculator::GetDlDelay (uint64_t imsi, uint8_t lcid)
543 {
544  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
545  ImsiLcidPair_t p (imsi, lcid);
546  Uint64StatsMap::iterator it = m_dlDelay.find (p);
547  if (it == m_dlDelay.end ())
548  {
549  NS_LOG_ERROR ("DL delay for " << imsi << " not found");
550  return 0;
551  }
552  return m_dlDelay[p]->getMean ();
553 }
554 
555 std::vector<double>
556 RadioBearerStatsCalculator::GetDlDelayStats (uint64_t imsi, uint8_t lcid)
557 {
558  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
559  ImsiLcidPair_t p (imsi, lcid);
560  std::vector<double> stats;
561  Uint64StatsMap::iterator it = m_dlDelay.find (p);
562  if (it == m_dlDelay.end ())
563  {
564  stats.push_back (0.0);
565  stats.push_back (0.0);
566  stats.push_back (0.0);
567  stats.push_back (0.0);
568  return stats;
569 
570  }
571  stats.push_back (m_dlDelay[p]->getMean ());
572  stats.push_back (m_dlDelay[p]->getStddev ());
573  stats.push_back (m_dlDelay[p]->getMin ());
574  stats.push_back (m_dlDelay[p]->getMax ());
575  return stats;
576 }
577 
578 std::vector<double>
580 {
581  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
582  ImsiLcidPair_t p (imsi, lcid);
583  std::vector<double> stats;
584  Uint32StatsMap::iterator it = m_dlPduSize.find (p);
585  if (it == m_dlPduSize.end ())
586  {
587  stats.push_back (0.0);
588  stats.push_back (0.0);
589  stats.push_back (0.0);
590  stats.push_back (0.0);
591  return stats;
592 
593  }
594  stats.push_back (m_dlPduSize[p]->getMean ());
595  stats.push_back (m_dlPduSize[p]->getStddev ());
596  stats.push_back (m_dlPduSize[p]->getMin ());
597  stats.push_back (m_dlPduSize[p]->getMax ());
598  return stats;
599 }
600 
601 std::string
603 {
604  if (m_protocolType == "RLC")
605  {
607  }
608  else
609  {
610  return GetUlPdcpOutputFilename ();
611  }
612 }
613 
614 std::string
616 {
617  if (m_protocolType == "RLC")
618  {
620  }
621  else
622  {
623  return GetDlPdcpOutputFilename ();
624  }
625 }
626 
627 void
629 {
630  m_ulPdcpOutputFilename = outputFilename;
631 }
632 
633 std::string
635 {
636  return m_ulPdcpOutputFilename;
637 }
638 void
640 {
641  m_dlPdcpOutputFilename = outputFilename;
642 }
643 
644 std::string
646 {
647  return m_dlPdcpOutputFilename;
648 }
649 
650 } // 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:1055
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:1056
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:353
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:993
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.