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  .AddAttribute ("StartTime", "Start time of the on going epoch.",
63  TimeValue (Seconds (0.)),
66  MakeTimeChecker ())
67  .AddAttribute ("EpochDuration", "Epoch duration.",
68  TimeValue (Seconds (0.25)),
71  MakeTimeChecker ())
72  .AddAttribute ("DlRlcOutputFilename",
73  "Name of the file where the downlink results will be saved.",
74  StringValue ("DlRlcStats.txt"),
77  .AddAttribute ("UlRlcOutputFilename",
78  "Name of the file where the uplink results will be saved.",
79  StringValue ("UlRlcStats.txt"),
82  .AddAttribute ("DlPdcpOutputFilename",
83  "Name of the file where the downlink results will be saved.",
84  StringValue ("DlPdcpStats.txt"),
87  .AddAttribute ("UlPdcpOutputFilename",
88  "Name of the file where the uplink results will be saved.",
89  StringValue ("UlPdcpStats.txt"),
92  ;
93  return tid;
94 }
95 
96 void
98 {
99  NS_LOG_FUNCTION (this);
100  if (m_pendingOutput)
101  {
102  ShowResults ();
103  }
104 }
105 
106 void
108 {
109  m_startTime = t;
111 }
112 
113 Time
115 {
116  return m_startTime;
117 }
118 
119 void
121 {
122  m_epochDuration = e;
124 }
125 
126 Time
128 {
129  return m_epochDuration;
130 }
131 
132 void
133 RadioBearerStatsCalculator::UlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
134 {
135  NS_LOG_FUNCTION (this << "UlTxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize);
136  ImsiLcidPair_t p (imsi, lcid);
137  if (Simulator::Now () >= m_startTime)
138  {
139  m_ulCellId[p] = cellId;
140  m_flowId[p] = LteFlowId_t (rnti, lcid);
141  m_ulTxPackets[p]++;
142  m_ulTxData[p] += packetSize;
143  }
144  m_pendingOutput = true;
145 }
146 
147 void
148 RadioBearerStatsCalculator::DlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
149 {
150  NS_LOG_FUNCTION (this << "DlTxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize);
151  ImsiLcidPair_t p (imsi, lcid);
152  if (Simulator::Now () >= m_startTime)
153  {
154  m_dlCellId[p] = cellId;
155  m_flowId[p] = LteFlowId_t (rnti, lcid);
156  m_dlTxPackets[p]++;
157  m_dlTxData[p] += packetSize;
158  }
159  m_pendingOutput = true;
160 }
161 
162 void
163 RadioBearerStatsCalculator::UlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize,
164  uint64_t delay)
165 {
166  NS_LOG_FUNCTION (this << "UlRxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize << delay);
167  ImsiLcidPair_t p (imsi, lcid);
168  if (Simulator::Now () >= m_startTime)
169  {
170  m_ulCellId[p] = cellId;
171  m_ulRxPackets[p]++;
172  m_ulRxData[p] += packetSize;
173 
174  Uint64StatsMap::iterator it = m_ulDelay.find (p);
175  if (it == m_ulDelay.end ())
176  {
177  NS_LOG_DEBUG (this << " Creating UL stats calculators for IMSI " << p.m_imsi << " and LCID " << (uint32_t) p.m_lcId);
178  m_ulDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
179  m_ulPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t> > ();
180  }
181  m_ulDelay[p]->Update (delay);
182  m_ulPduSize[p]->Update (packetSize);
183  }
184  m_pendingOutput = true;
185 }
186 
187 void
188 RadioBearerStatsCalculator::DlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
189 {
190  NS_LOG_FUNCTION (this << "DlRxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize << delay);
191  ImsiLcidPair_t p (imsi, lcid);
192  if (Simulator::Now () >= m_startTime)
193  {
194  m_dlCellId[p] = cellId;
195  m_dlRxPackets[p]++;
196  m_dlRxData[p] += packetSize;
197 
198  Uint64StatsMap::iterator it = m_dlDelay.find (p);
199  if (it == m_dlDelay.end ())
200  {
201  NS_LOG_DEBUG (this << " Creating DL stats calculators for IMSI " << p.m_imsi << " and LCID " << (uint32_t) p.m_lcId);
202  m_dlDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
203  m_dlPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t> > ();
204  }
205  m_dlDelay[p]->Update (delay);
206  m_dlPduSize[p]->Update (packetSize);
207  }
208  m_pendingOutput = true;
209 }
210 
211 void
213 {
214 
215  NS_LOG_FUNCTION (this << GetUlOutputFilename ().c_str () << GetDlOutputFilename ().c_str ());
216  NS_LOG_INFO ("Write Rlc Stats in " << GetUlOutputFilename ().c_str () << " and in " << GetDlOutputFilename ().c_str ());
217 
218  std::ofstream ulOutFile;
219  std::ofstream dlOutFile;
220 
221  if (m_firstWrite == true)
222  {
223  ulOutFile.open (GetUlOutputFilename ().c_str ());
224  if (!ulOutFile.is_open ())
225  {
226  NS_LOG_ERROR ("Can't open file " << GetUlOutputFilename ().c_str ());
227  return;
228  }
229 
230  dlOutFile.open (GetDlOutputFilename ().c_str ());
231  if (!dlOutFile.is_open ())
232  {
233  NS_LOG_ERROR ("Can't open file " << GetDlOutputFilename ().c_str ());
234  return;
235  }
236  m_firstWrite = false;
237  ulOutFile << "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
238  ulOutFile << "delay\tstdDev\tmin\tmax\t";
239  ulOutFile << "PduSize\tstdDev\tmin\tmax";
240  ulOutFile << std::endl;
241  dlOutFile << "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
242  dlOutFile << "delay\tstdDev\tmin\tmax\t";
243  dlOutFile << "PduSize\tstdDev\tmin\tmax";
244  dlOutFile << std::endl;
245  }
246  else
247  {
248  ulOutFile.open (GetUlOutputFilename ().c_str (), std::ios_base::app);
249  if (!ulOutFile.is_open ())
250  {
251  NS_LOG_ERROR ("Can't open file " << GetUlOutputFilename ().c_str ());
252  return;
253  }
254 
255  dlOutFile.open (GetDlOutputFilename ().c_str (), std::ios_base::app);
256  if (!dlOutFile.is_open ())
257  {
258  NS_LOG_ERROR ("Can't open file " << GetDlOutputFilename ().c_str ());
259  return;
260  }
261  }
262 
263  WriteUlResults (ulOutFile);
264  WriteDlResults (dlOutFile);
265  m_pendingOutput = false;
266 
267 }
268 
269 void
271 {
272  NS_LOG_FUNCTION (this);
273 
274  // Get the unique IMSI / LCID list
275 
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  Time endTime = m_startTime + m_epochDuration;
286  for (std::vector<ImsiLcidPair_t>::iterator it = pairVector.begin (); it != pairVector.end (); ++it)
287  {
288  ImsiLcidPair_t p = *it;
289  outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
290  outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
291  outFile << GetUlCellId (p.m_imsi, p.m_lcId) << "\t";
292  outFile << p.m_imsi << "\t";
293  outFile << m_flowId[p].m_rnti << "\t";
294  outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
295  outFile << GetUlTxPackets (p.m_imsi, p.m_lcId) << "\t";
296  outFile << GetUlTxData (p.m_imsi, p.m_lcId) << "\t";
297  outFile << GetUlRxPackets (p.m_imsi, p.m_lcId) << "\t";
298  outFile << GetUlRxData (p.m_imsi, p.m_lcId) << "\t";
299  std::vector<double> stats = GetUlDelayStats (p.m_imsi, p.m_lcId);
300  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
301  {
302  outFile << (*it) * 1e-9 << "\t";
303  }
304  stats = GetUlPduSizeStats (p.m_imsi, p.m_lcId);
305  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
306  {
307  outFile << (*it) << "\t";
308  }
309  outFile << std::endl;
310  }
311 
312  outFile.close ();
313 }
314 
315 void
317 {
318  NS_LOG_FUNCTION (this);
319 
320  // Get the unique IMSI list
321  std::vector < ImsiLcidPair_t > pairVector;
322  for (Uint32Map::iterator it = m_dlTxPackets.begin (); it != m_dlTxPackets.end (); ++it)
323  {
324  if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
325  {
326  pairVector.push_back ((*it).first);
327  }
328  }
329 
330  Time endTime = m_startTime + m_epochDuration;
331  for (std::vector<ImsiLcidPair_t>::iterator pair = pairVector.begin (); pair != pairVector.end (); ++pair)
332  {
333  ImsiLcidPair_t p = *pair;
334  outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
335  outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
336  outFile << GetDlCellId (p.m_imsi, p.m_lcId) << "\t";
337  outFile << p.m_imsi << "\t";
338  outFile << m_flowId[p].m_rnti << "\t";
339  outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
340  outFile << GetDlTxPackets (p.m_imsi, p.m_lcId) << "\t";
341  outFile << GetDlTxData (p.m_imsi, p.m_lcId) << "\t";
342  outFile << GetDlRxPackets (p.m_imsi, p.m_lcId) << "\t";
343  outFile << GetDlRxData (p.m_imsi, p.m_lcId) << "\t";
344  std::vector<double> stats = GetDlDelayStats (p.m_imsi, p.m_lcId);
345  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
346  {
347  outFile << (*it) * 1e-9 << "\t";
348  }
349  stats = GetDlPduSizeStats (p.m_imsi, p.m_lcId);
350  for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
351  {
352  outFile << (*it) << "\t";
353  }
354  outFile << std::endl;
355  }
356 
357  outFile.close ();
358 }
359 
360 void
362 {
363  NS_LOG_FUNCTION (this);
364 
365  m_ulTxPackets.erase (m_ulTxPackets.begin (), m_ulTxPackets.end ());
366  m_ulRxPackets.erase (m_ulRxPackets.begin (), m_ulRxPackets.end ());
367  m_ulRxData.erase (m_ulRxData.begin (), m_ulRxData.end ());
368  m_ulTxData.erase (m_ulTxData.begin (), m_ulTxData.end ());
369  m_ulDelay.erase (m_ulDelay.begin (), m_ulDelay.end ());
370  m_ulPduSize.erase (m_ulPduSize.begin (), m_ulPduSize.end ());
371 
372  m_dlTxPackets.erase (m_dlTxPackets.begin (), m_dlTxPackets.end ());
373  m_dlRxPackets.erase (m_dlRxPackets.begin (), m_dlRxPackets.end ());
374  m_dlRxData.erase (m_dlRxData.begin (), m_dlRxData.end ());
375  m_dlTxData.erase (m_dlTxData.begin (), m_dlTxData.end ());
376  m_dlDelay.erase (m_dlDelay.begin (), m_dlDelay.end ());
377  m_dlPduSize.erase (m_dlPduSize.begin (), m_dlPduSize.end ());
378 }
379 
380 void
382 {
383  NS_LOG_FUNCTION (this);
385  NS_ASSERT (Simulator::Now ().GetMilliSeconds () == 0); // below event time assumes this
387 }
388 
389 void
391 {
392  NS_LOG_FUNCTION (this);
393  ShowResults ();
394  ResetResults ();
397 }
398 
399 uint32_t
400 RadioBearerStatsCalculator::GetUlTxPackets (uint64_t imsi, uint8_t lcid)
401 {
402  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
403  ImsiLcidPair_t p (imsi, lcid);
404  return m_ulTxPackets[p];
405 }
406 
407 uint32_t
408 RadioBearerStatsCalculator::GetUlRxPackets (uint64_t imsi, uint8_t lcid)
409 {
410  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
411  ImsiLcidPair_t p (imsi, lcid);
412  return m_ulRxPackets[p];
413 }
414 
415 uint64_t
416 RadioBearerStatsCalculator::GetUlTxData (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_ulTxData[p];
421 }
422 
423 uint64_t
424 RadioBearerStatsCalculator::GetUlRxData (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_ulRxData[p];
429 }
430 
431 double
432 RadioBearerStatsCalculator::GetUlDelay (uint64_t imsi, uint8_t lcid)
433 {
434  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
435  ImsiLcidPair_t p (imsi, lcid);
436  Uint64StatsMap::iterator it = m_ulDelay.find (p);
437  if (it == m_ulDelay.end ())
438  {
439  NS_LOG_ERROR ("UL delay for " << imsi << " - " << (uint16_t) lcid << " not found");
440  return 0;
441 
442  }
443  return m_ulDelay[p]->getMean ();
444 }
445 
446 std::vector<double>
447 RadioBearerStatsCalculator::GetUlDelayStats (uint64_t imsi, uint8_t lcid)
448 {
449  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
450  ImsiLcidPair_t p (imsi, lcid);
451  std::vector<double> stats;
452  Uint64StatsMap::iterator it = m_ulDelay.find (p);
453  if (it == m_ulDelay.end ())
454  {
455  stats.push_back (0.0);
456  stats.push_back (0.0);
457  stats.push_back (0.0);
458  stats.push_back (0.0);
459  return stats;
460 
461  }
462  stats.push_back (m_ulDelay[p]->getMean ());
463  stats.push_back (m_ulDelay[p]->getStddev ());
464  stats.push_back (m_ulDelay[p]->getMin ());
465  stats.push_back (m_ulDelay[p]->getMax ());
466  return stats;
467 }
468 
469 std::vector<double>
471 {
472  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
473  ImsiLcidPair_t p (imsi, lcid);
474  std::vector<double> stats;
475  Uint32StatsMap::iterator it = m_ulPduSize.find (p);
476  if (it == m_ulPduSize.end ())
477  {
478  stats.push_back (0.0);
479  stats.push_back (0.0);
480  stats.push_back (0.0);
481  stats.push_back (0.0);
482  return stats;
483 
484  }
485  stats.push_back (m_ulPduSize[p]->getMean ());
486  stats.push_back (m_ulPduSize[p]->getStddev ());
487  stats.push_back (m_ulPduSize[p]->getMin ());
488  stats.push_back (m_ulPduSize[p]->getMax ());
489  return stats;
490 }
491 
492 uint32_t
493 RadioBearerStatsCalculator::GetDlTxPackets (uint64_t imsi, uint8_t lcid)
494 {
495  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
496  ImsiLcidPair_t p (imsi, lcid);
497  return m_dlTxPackets[p];
498 }
499 
500 uint32_t
501 RadioBearerStatsCalculator::GetDlRxPackets (uint64_t imsi, uint8_t lcid)
502 {
503  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
504  ImsiLcidPair_t p (imsi, lcid);
505  return m_dlRxPackets[p];
506 }
507 
508 uint64_t
509 RadioBearerStatsCalculator::GetDlTxData (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_dlTxData[p];
514 }
515 
516 uint64_t
517 RadioBearerStatsCalculator::GetDlRxData (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_dlRxData[p];
522 }
523 
524 uint32_t
525 RadioBearerStatsCalculator::GetUlCellId (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_ulCellId[p];
530 }
531 
532 uint32_t
533 RadioBearerStatsCalculator::GetDlCellId (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_dlCellId[p];
538 }
539 
540 double
541 RadioBearerStatsCalculator::GetDlDelay (uint64_t imsi, uint8_t lcid)
542 {
543  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
544  ImsiLcidPair_t p (imsi, lcid);
545  Uint64StatsMap::iterator it = m_dlDelay.find (p);
546  if (it == m_dlDelay.end ())
547  {
548  NS_LOG_ERROR ("DL delay for " << imsi << " not found");
549  return 0;
550  }
551  return m_dlDelay[p]->getMean ();
552 }
553 
554 std::vector<double>
555 RadioBearerStatsCalculator::GetDlDelayStats (uint64_t imsi, uint8_t lcid)
556 {
557  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
558  ImsiLcidPair_t p (imsi, lcid);
559  std::vector<double> stats;
560  Uint64StatsMap::iterator it = m_dlDelay.find (p);
561  if (it == m_dlDelay.end ())
562  {
563  stats.push_back (0.0);
564  stats.push_back (0.0);
565  stats.push_back (0.0);
566  stats.push_back (0.0);
567  return stats;
568 
569  }
570  stats.push_back (m_dlDelay[p]->getMean ());
571  stats.push_back (m_dlDelay[p]->getStddev ());
572  stats.push_back (m_dlDelay[p]->getMin ());
573  stats.push_back (m_dlDelay[p]->getMax ());
574  return stats;
575 }
576 
577 std::vector<double>
579 {
580  NS_LOG_FUNCTION (this << imsi << (uint16_t) lcid);
581  ImsiLcidPair_t p (imsi, lcid);
582  std::vector<double> stats;
583  Uint32StatsMap::iterator it = m_dlPduSize.find (p);
584  if (it == m_dlPduSize.end ())
585  {
586  stats.push_back (0.0);
587  stats.push_back (0.0);
588  stats.push_back (0.0);
589  stats.push_back (0.0);
590  return stats;
591 
592  }
593  stats.push_back (m_dlPduSize[p]->getMean ());
594  stats.push_back (m_dlPduSize[p]->getStddev ());
595  stats.push_back (m_dlPduSize[p]->getMin ());
596  stats.push_back (m_dlPduSize[p]->getMax ());
597  return stats;
598 }
599 
600 std::string
602 {
603  if (m_protocolType == "RLC")
604  {
606  }
607  else
608  {
609  return GetUlPdcpOutputFilename ();
610  }
611 }
612 
613 std::string
615 {
616  if (m_protocolType == "RLC")
617  {
619  }
620  else
621  {
622  return GetDlPdcpOutputFilename ();
623  }
624 }
625 
626 void
628 {
629  m_ulPdcpOutputFilename = outputFilename;
630 }
631 
632 std::string
634 {
635  return m_ulPdcpOutputFilename;
636 }
637 void
639 {
640  m_dlPdcpOutputFilename = outputFilename;
641 }
642 
643 std::string
645 {
646  return m_dlPdcpOutputFilename;
647 }
648 
649 } // 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:95
#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:44
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:61
#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:244
Uint64Map m_ulTxData
Amount of UL TX Data by (IMSI, LCID) pair.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:819
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:439
void DoDispose()
Destructor implementation.
uint32_t GetUlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink packets.
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:921
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:922
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
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:339
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.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
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:859
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:220
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
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:51
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
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.