A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
radio-bearer-stats-calculator.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Jaume Nin <jnin@cttc.es>
18 * Nicola Baldo <nbaldo@cttc.es>
19 */
20
22
23#include "ns3/nstime.h"
24#include "ns3/string.h"
25#include <ns3/log.h>
26
27#include <algorithm>
28#include <vector>
29
30namespace ns3
31{
32
33NS_LOG_COMPONENT_DEFINE("RadioBearerStatsCalculator");
34
35NS_OBJECT_ENSURE_REGISTERED(RadioBearerStatsCalculator);
36
38 : m_firstWrite(true),
39 m_pendingOutput(false),
40 m_protocolType("RLC")
41{
42 NS_LOG_FUNCTION(this);
43}
44
46 : m_firstWrite(true),
47 m_pendingOutput(false)
48{
49 NS_LOG_FUNCTION(this);
50 m_protocolType = protocolType;
51}
52
54{
55 NS_LOG_FUNCTION(this);
56}
57
60{
61 static TypeId tid =
62 TypeId("ns3::RadioBearerStatsCalculator")
64 .AddConstructor<RadioBearerStatsCalculator>()
65 .SetGroupName("Lte")
66 .AddAttribute("StartTime",
67 "Start time of the on going epoch.",
68 TimeValue(Seconds(0.)),
72 .AddAttribute("EpochDuration",
73 "Epoch duration.",
74 TimeValue(Seconds(0.25)),
78 .AddAttribute("DlRlcOutputFilename",
79 "Name of the file where the downlink results will be saved.",
80 StringValue("DlRlcStats.txt"),
83 .AddAttribute("UlRlcOutputFilename",
84 "Name of the file where the uplink results will be saved.",
85 StringValue("UlRlcStats.txt"),
88 .AddAttribute("DlPdcpOutputFilename",
89 "Name of the file where the downlink results will be saved.",
90 StringValue("DlPdcpStats.txt"),
93 .AddAttribute("UlPdcpOutputFilename",
94 "Name of the file where the uplink results will be saved.",
95 StringValue("UlPdcpStats.txt"),
98 return tid;
99}
100
101void
103{
104 NS_LOG_FUNCTION(this);
105 if (m_pendingOutput)
106 {
107 ShowResults();
108 }
109}
110
111void
113{
114 m_startTime = t;
116}
117
118Time
120{
121 return m_startTime;
122}
123
124void
126{
127 m_epochDuration = e;
129}
130
131Time
133{
134 return m_epochDuration;
135}
136
137void
139 uint64_t imsi,
140 uint16_t rnti,
141 uint8_t lcid,
143{
144 NS_LOG_FUNCTION(this << "UlTxPDU" << cellId << imsi << rnti << (uint32_t)lcid << packetSize);
145 ImsiLcidPair_t p(imsi, lcid);
147 {
148 m_ulCellId[p] = cellId;
149 m_flowId[p] = LteFlowId_t(rnti, lcid);
150 m_ulTxPackets[p]++;
152 }
153 m_pendingOutput = true;
154}
155
156void
158 uint64_t imsi,
159 uint16_t rnti,
160 uint8_t lcid,
162{
163 NS_LOG_FUNCTION(this << "DlTxPDU" << cellId << imsi << rnti << (uint32_t)lcid << packetSize);
164 ImsiLcidPair_t p(imsi, lcid);
166 {
167 m_dlCellId[p] = cellId;
168 m_flowId[p] = LteFlowId_t(rnti, lcid);
169 m_dlTxPackets[p]++;
171 }
172 m_pendingOutput = true;
173}
174
175void
177 uint64_t imsi,
178 uint16_t rnti,
179 uint8_t lcid,
181 uint64_t delay)
182{
183 NS_LOG_FUNCTION(this << "UlRxPDU" << cellId << imsi << rnti << (uint32_t)lcid << packetSize
184 << delay);
185 ImsiLcidPair_t p(imsi, lcid);
187 {
188 m_ulCellId[p] = cellId;
189 m_ulRxPackets[p]++;
191
192 Uint64StatsMap::iterator it = m_ulDelay.find(p);
193 if (it == m_ulDelay.end())
194 {
195 NS_LOG_DEBUG(this << " Creating UL stats calculators for IMSI " << p.m_imsi
196 << " and LCID " << (uint32_t)p.m_lcId);
197 m_ulDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t>>();
198 m_ulPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t>>();
199 }
200 m_ulDelay[p]->Update(delay);
201 m_ulPduSize[p]->Update(packetSize);
202 }
203 m_pendingOutput = true;
204}
205
206void
208 uint64_t imsi,
209 uint16_t rnti,
210 uint8_t lcid,
212 uint64_t delay)
213{
214 NS_LOG_FUNCTION(this << "DlRxPDU" << cellId << imsi << rnti << (uint32_t)lcid << packetSize
215 << delay);
216 ImsiLcidPair_t p(imsi, lcid);
218 {
219 m_dlCellId[p] = cellId;
220 m_dlRxPackets[p]++;
222
223 Uint64StatsMap::iterator it = m_dlDelay.find(p);
224 if (it == m_dlDelay.end())
225 {
226 NS_LOG_DEBUG(this << " Creating DL stats calculators for IMSI " << p.m_imsi
227 << " and LCID " << (uint32_t)p.m_lcId);
228 m_dlDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t>>();
229 m_dlPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t>>();
230 }
231 m_dlDelay[p]->Update(delay);
232 m_dlPduSize[p]->Update(packetSize);
233 }
234 m_pendingOutput = true;
235}
236
237void
239{
241 NS_LOG_INFO("Write Rlc Stats in " << GetUlOutputFilename() << " and in "
243
244 std::ofstream ulOutFile;
245 std::ofstream dlOutFile;
246
247 if (m_firstWrite)
248 {
249 ulOutFile.open(GetUlOutputFilename());
250 if (!ulOutFile.is_open())
251 {
252 NS_LOG_ERROR("Can't open file " << GetUlOutputFilename());
253 return;
254 }
255
256 dlOutFile.open(GetDlOutputFilename());
257 if (!dlOutFile.is_open())
258 {
259 NS_LOG_ERROR("Can't open file " << GetDlOutputFilename());
260 return;
261 }
262 m_firstWrite = false;
263 ulOutFile << "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
264 ulOutFile << "delay\tstdDev\tmin\tmax\t";
265 ulOutFile << "PduSize\tstdDev\tmin\tmax";
266 ulOutFile << std::endl;
267 dlOutFile << "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
268 dlOutFile << "delay\tstdDev\tmin\tmax\t";
269 dlOutFile << "PduSize\tstdDev\tmin\tmax";
270 dlOutFile << std::endl;
271 }
272 else
273 {
274 ulOutFile.open(GetUlOutputFilename(), std::ios_base::app);
275 if (!ulOutFile.is_open())
276 {
277 NS_LOG_ERROR("Can't open file " << GetUlOutputFilename());
278 return;
279 }
280
281 dlOutFile.open(GetDlOutputFilename(), std::ios_base::app);
282 if (!dlOutFile.is_open())
283 {
284 NS_LOG_ERROR("Can't open file " << GetDlOutputFilename());
285 return;
286 }
287 }
288
289 WriteUlResults(ulOutFile);
290 WriteDlResults(dlOutFile);
291 m_pendingOutput = false;
292}
293
294void
296{
297 NS_LOG_FUNCTION(this);
298
299 // Get the unique IMSI/LCID pairs list
300 std::vector<ImsiLcidPair_t> pairVector;
301 for (Uint32Map::iterator it = m_ulTxPackets.begin(); it != m_ulTxPackets.end(); ++it)
302 {
303 if (find(pairVector.begin(), pairVector.end(), (*it).first) == pairVector.end())
304 {
305 pairVector.push_back((*it).first);
306 }
307 }
308
309 for (Uint32Map::iterator it = m_ulRxPackets.begin(); it != m_ulRxPackets.end(); ++it)
310 {
311 if (find(pairVector.begin(), pairVector.end(), (*it).first) == pairVector.end())
312 {
313 pairVector.push_back((*it).first);
314 }
315 }
316
317 Time endTime = m_startTime + m_epochDuration;
318 for (std::vector<ImsiLcidPair_t>::iterator it = pairVector.begin(); it != pairVector.end();
319 ++it)
320 {
321 ImsiLcidPair_t p = *it;
322 FlowIdMap::const_iterator flowIdIt = m_flowId.find(p);
323 NS_ASSERT_MSG(flowIdIt != m_flowId.end(),
324 "FlowId (imsi " << p.m_imsi << " lcid " << (uint32_t)p.m_lcId
325 << ") is missing");
326 LteFlowId_t flowId = flowIdIt->second;
327 NS_ASSERT_MSG(flowId.m_lcId == p.m_lcId, "lcid mismatch");
328
329 outFile << m_startTime.GetSeconds() << "\t";
330 outFile << endTime.GetSeconds() << "\t";
331 outFile << GetUlCellId(p.m_imsi, p.m_lcId) << "\t";
332 outFile << p.m_imsi << "\t";
333 outFile << flowId.m_rnti << "\t";
334 outFile << (uint32_t)flowId.m_lcId << "\t";
335 outFile << GetUlTxPackets(p.m_imsi, p.m_lcId) << "\t";
336 outFile << GetUlTxData(p.m_imsi, p.m_lcId) << "\t";
337 outFile << GetUlRxPackets(p.m_imsi, p.m_lcId) << "\t";
338 outFile << GetUlRxData(p.m_imsi, p.m_lcId) << "\t";
339 std::vector<double> stats = GetUlDelayStats(p.m_imsi, p.m_lcId);
340 for (std::vector<double>::iterator it = stats.begin(); it != stats.end(); ++it)
341 {
342 outFile << (*it) * 1e-9 << "\t";
343 }
344 stats = GetUlPduSizeStats(p.m_imsi, p.m_lcId);
345 for (std::vector<double>::iterator it = stats.begin(); it != stats.end(); ++it)
346 {
347 outFile << (*it) << "\t";
348 }
349 outFile << std::endl;
350 }
351
352 outFile.close();
353}
354
355void
357{
358 NS_LOG_FUNCTION(this);
359
360 // Get the unique IMSI/LCID pairs list
361 std::vector<ImsiLcidPair_t> pairVector;
362 for (Uint32Map::iterator it = m_dlTxPackets.begin(); it != m_dlTxPackets.end(); ++it)
363 {
364 if (find(pairVector.begin(), pairVector.end(), (*it).first) == pairVector.end())
365 {
366 pairVector.push_back((*it).first);
367 }
368 }
369
370 for (Uint32Map::iterator it = m_dlRxPackets.begin(); it != m_dlRxPackets.end(); ++it)
371 {
372 if (find(pairVector.begin(), pairVector.end(), (*it).first) == pairVector.end())
373 {
374 pairVector.push_back((*it).first);
375 }
376 }
377
378 Time endTime = m_startTime + m_epochDuration;
379 for (std::vector<ImsiLcidPair_t>::iterator pair = pairVector.begin(); pair != pairVector.end();
380 ++pair)
381 {
382 ImsiLcidPair_t p = *pair;
383 FlowIdMap::const_iterator flowIdIt = m_flowId.find(p);
384 NS_ASSERT_MSG(flowIdIt != m_flowId.end(),
385 "FlowId (imsi " << p.m_imsi << " lcid " << (uint32_t)p.m_lcId
386 << ") is missing");
387 LteFlowId_t flowId = flowIdIt->second;
388 NS_ASSERT_MSG(flowId.m_lcId == p.m_lcId, "lcid mismatch");
389
390 outFile << m_startTime.GetSeconds() << "\t";
391 outFile << endTime.GetSeconds() << "\t";
392 outFile << GetDlCellId(p.m_imsi, p.m_lcId) << "\t";
393 outFile << p.m_imsi << "\t";
394 outFile << flowId.m_rnti << "\t";
395 outFile << (uint32_t)flowId.m_lcId << "\t";
396 outFile << GetDlTxPackets(p.m_imsi, p.m_lcId) << "\t";
397 outFile << GetDlTxData(p.m_imsi, p.m_lcId) << "\t";
398 outFile << GetDlRxPackets(p.m_imsi, p.m_lcId) << "\t";
399 outFile << GetDlRxData(p.m_imsi, p.m_lcId) << "\t";
400 std::vector<double> stats = GetDlDelayStats(p.m_imsi, p.m_lcId);
401 for (std::vector<double>::iterator it = stats.begin(); it != stats.end(); ++it)
402 {
403 outFile << (*it) * 1e-9 << "\t";
404 }
405 stats = GetDlPduSizeStats(p.m_imsi, p.m_lcId);
406 for (std::vector<double>::iterator it = stats.begin(); it != stats.end(); ++it)
407 {
408 outFile << (*it) << "\t";
409 }
410 outFile << std::endl;
411 }
412
413 outFile.close();
414}
415
416void
418{
419 NS_LOG_FUNCTION(this);
420
421 m_ulTxPackets.erase(m_ulTxPackets.begin(), m_ulTxPackets.end());
422 m_ulRxPackets.erase(m_ulRxPackets.begin(), m_ulRxPackets.end());
423 m_ulRxData.erase(m_ulRxData.begin(), m_ulRxData.end());
424 m_ulTxData.erase(m_ulTxData.begin(), m_ulTxData.end());
425 m_ulDelay.erase(m_ulDelay.begin(), m_ulDelay.end());
426 m_ulPduSize.erase(m_ulPduSize.begin(), m_ulPduSize.end());
427
428 m_dlTxPackets.erase(m_dlTxPackets.begin(), m_dlTxPackets.end());
429 m_dlRxPackets.erase(m_dlRxPackets.begin(), m_dlRxPackets.end());
430 m_dlRxData.erase(m_dlRxData.begin(), m_dlRxData.end());
431 m_dlTxData.erase(m_dlTxData.begin(), m_dlTxData.end());
432 m_dlDelay.erase(m_dlDelay.begin(), m_dlDelay.end());
433 m_dlPduSize.erase(m_dlPduSize.begin(), m_dlPduSize.end());
434}
435
436void
438{
439 NS_LOG_FUNCTION(this);
441 NS_ASSERT(Simulator::Now().GetMilliSeconds() == 0); // below event time assumes this
444 this);
445}
446
447void
449{
450 NS_LOG_FUNCTION(this);
451 ShowResults();
452 ResetResults();
456}
457
460{
461 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
462 ImsiLcidPair_t p(imsi, lcid);
463 return m_ulTxPackets[p];
464}
465
468{
469 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
470 ImsiLcidPair_t p(imsi, lcid);
471 return m_ulRxPackets[p];
472}
473
474uint64_t
475RadioBearerStatsCalculator::GetUlTxData(uint64_t imsi, uint8_t lcid)
476{
477 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
478 ImsiLcidPair_t p(imsi, lcid);
479 return m_ulTxData[p];
480}
481
482uint64_t
483RadioBearerStatsCalculator::GetUlRxData(uint64_t imsi, uint8_t lcid)
484{
485 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
486 ImsiLcidPair_t p(imsi, lcid);
487 return m_ulRxData[p];
488}
489
490double
491RadioBearerStatsCalculator::GetUlDelay(uint64_t imsi, uint8_t lcid)
492{
493 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
494 ImsiLcidPair_t p(imsi, lcid);
495 Uint64StatsMap::iterator it = m_ulDelay.find(p);
496 if (it == m_ulDelay.end())
497 {
498 NS_LOG_ERROR("UL delay for " << imsi << " - " << (uint16_t)lcid << " not found");
499 return 0;
500 }
501 return m_ulDelay[p]->getMean();
502}
503
504std::vector<double>
506{
507 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
508 ImsiLcidPair_t p(imsi, lcid);
509 std::vector<double> stats;
510 Uint64StatsMap::iterator it = m_ulDelay.find(p);
511 if (it == m_ulDelay.end())
512 {
513 stats.push_back(0.0);
514 stats.push_back(0.0);
515 stats.push_back(0.0);
516 stats.push_back(0.0);
517 return stats;
518 }
519 stats.push_back(m_ulDelay[p]->getMean());
520 stats.push_back(m_ulDelay[p]->getStddev());
521 stats.push_back(m_ulDelay[p]->getMin());
522 stats.push_back(m_ulDelay[p]->getMax());
523 return stats;
524}
525
526std::vector<double>
528{
529 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
530 ImsiLcidPair_t p(imsi, lcid);
531 std::vector<double> stats;
532 Uint32StatsMap::iterator it = m_ulPduSize.find(p);
533 if (it == m_ulPduSize.end())
534 {
535 stats.push_back(0.0);
536 stats.push_back(0.0);
537 stats.push_back(0.0);
538 stats.push_back(0.0);
539 return stats;
540 }
541 stats.push_back(m_ulPduSize[p]->getMean());
542 stats.push_back(m_ulPduSize[p]->getStddev());
543 stats.push_back(m_ulPduSize[p]->getMin());
544 stats.push_back(m_ulPduSize[p]->getMax());
545 return stats;
546}
547
550{
551 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
552 ImsiLcidPair_t p(imsi, lcid);
553 return m_dlTxPackets[p];
554}
555
558{
559 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
560 ImsiLcidPair_t p(imsi, lcid);
561 return m_dlRxPackets[p];
562}
563
564uint64_t
565RadioBearerStatsCalculator::GetDlTxData(uint64_t imsi, uint8_t lcid)
566{
567 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
568 ImsiLcidPair_t p(imsi, lcid);
569 return m_dlTxData[p];
570}
571
572uint64_t
573RadioBearerStatsCalculator::GetDlRxData(uint64_t imsi, uint8_t lcid)
574{
575 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
576 ImsiLcidPair_t p(imsi, lcid);
577 return m_dlRxData[p];
578}
579
581RadioBearerStatsCalculator::GetUlCellId(uint64_t imsi, uint8_t lcid)
582{
583 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
584 ImsiLcidPair_t p(imsi, lcid);
585 return m_ulCellId[p];
586}
587
589RadioBearerStatsCalculator::GetDlCellId(uint64_t imsi, uint8_t lcid)
590{
591 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
592 ImsiLcidPair_t p(imsi, lcid);
593 return m_dlCellId[p];
594}
595
596double
597RadioBearerStatsCalculator::GetDlDelay(uint64_t imsi, uint8_t lcid)
598{
599 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
600 ImsiLcidPair_t p(imsi, lcid);
601 Uint64StatsMap::iterator it = m_dlDelay.find(p);
602 if (it == m_dlDelay.end())
603 {
604 NS_LOG_ERROR("DL delay for " << imsi << " not found");
605 return 0;
606 }
607 return m_dlDelay[p]->getMean();
608}
609
610std::vector<double>
612{
613 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
614 ImsiLcidPair_t p(imsi, lcid);
615 std::vector<double> stats;
616 Uint64StatsMap::iterator it = m_dlDelay.find(p);
617 if (it == m_dlDelay.end())
618 {
619 stats.push_back(0.0);
620 stats.push_back(0.0);
621 stats.push_back(0.0);
622 stats.push_back(0.0);
623 return stats;
624 }
625 stats.push_back(m_dlDelay[p]->getMean());
626 stats.push_back(m_dlDelay[p]->getStddev());
627 stats.push_back(m_dlDelay[p]->getMin());
628 stats.push_back(m_dlDelay[p]->getMax());
629 return stats;
630}
631
632std::vector<double>
634{
635 NS_LOG_FUNCTION(this << imsi << (uint16_t)lcid);
636 ImsiLcidPair_t p(imsi, lcid);
637 std::vector<double> stats;
638 Uint32StatsMap::iterator it = m_dlPduSize.find(p);
639 if (it == m_dlPduSize.end())
640 {
641 stats.push_back(0.0);
642 stats.push_back(0.0);
643 stats.push_back(0.0);
644 stats.push_back(0.0);
645 return stats;
646 }
647 stats.push_back(m_dlPduSize[p]->getMean());
648 stats.push_back(m_dlPduSize[p]->getStddev());
649 stats.push_back(m_dlPduSize[p]->getMin());
650 stats.push_back(m_dlPduSize[p]->getMax());
651 return stats;
652}
653
654std::string
656{
657 if (m_protocolType == "RLC")
658 {
660 }
661 else
662 {
664 }
665}
666
667std::string
669{
670 if (m_protocolType == "RLC")
671 {
673 }
674 else
675 {
677 }
678}
679
680void
682{
683 m_ulPdcpOutputFilename = outputFilename;
684}
685
686std::string
688{
690}
691
692void
694{
695 m_dlPdcpOutputFilename = outputFilename;
696}
697
698std::string
700{
702}
703
704} // namespace ns3
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
Base class for ***StatsCalculator classes.
std::string GetUlOutputFilename()
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.
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
std::string GetDlOutputFilename()
Get the name of the file where the downlink statistics will be stored.
Uint32Map m_ulTxPackets
Number of UL TX Packets by (IMSI, LCID) pair.
Uint64StatsMap m_dlDelay
DL delay by (IMSI, LCID) pair.
std::vector< double > GetDlDelayStats(uint64_t imsi, uint8_t lcid)
Gets the downlink RLC to RLC statistics: average, min, max and standard deviation.
std::string m_protocolType
Protocol type, by default RLC.
Uint64Map m_dlRxData
Amount of DL RX Data by (IMSI, LCID) pair.
uint64_t GetDlTxData(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted downlink data bytes.
uint32_t GetUlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received uplink packets.
~RadioBearerStatsCalculator() override
Class destructor.
uint32_t GetDlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received downlink data bytes.
std::vector< double > GetDlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the downlink PDU size statistics: average, min, max and standard deviation.
void RescheduleEndEpoch()
Reschedules EndEpoch event.
Uint64StatsMap m_ulDelay
UL delay by (IMSI, LCID) pair.
uint32_t GetUlCellId(uint64_t imsi, uint8_t lcid)
Gets the attached Enb cellId.
Uint64Map m_ulRxData
Amount of UL RX Data by (IMSI, LCID) pair.
void EndEpoch()
Function called in every endEpochEvent.
Time m_startTime
Start time of the on going epoch.
std::vector< double > GetUlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the uplink PDU size statistics: average, min, max and standard deviation.
Uint64Map m_ulTxData
Amount of UL TX Data by (IMSI, LCID) pair.
std::string GetUlPdcpOutputFilename()
Get the name of the file where the uplink PDCP statistics will be stored.
void ShowResults()
Called after each epoch to write collected statistics to output files.
uint32_t GetDlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted downlink data bytes.
Uint32StatsMap m_ulPduSize
UL PDU Size by (IMSI, LCID) pair.
EventId m_endEpochEvent
Event id for next end epoch event.
void DoDispose() override
Destructor implementation.
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 GetUlRxData(uint64_t imsi, uint8_t lcid)
Gets the number of received uplink data bytes.
std::string m_dlPdcpOutputFilename
Name of the file where the downlink PDCP statistics will be saved.
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.
uint64_t GetDlRxData(uint64_t imsi, uint8_t lcid)
Gets the number of received downlink data bytes.
Uint32Map m_dlRxPackets
Number of DL RX Packets by (IMSI, LCID) pair.
std::string GetUlOutputFilename()
Get the name of the file where the uplink statistics will be stored.
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.
uint64_t GetUlTxData(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink data bytes.
std::string GetDlOutputFilename()
Get the name of the file where the downlink statistics will be stored.
std::string m_ulPdcpOutputFilename
Name of the file where the uplink PDCP statistics will be saved.
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.
void ResetResults()
Erases collected statistics.
void WriteDlResults(std::ofstream &outFile)
Writes collected statistics to DL output file and closes DL output file.
Uint32StatsMap m_dlPduSize
DL PDU Size by (IMSI, LCID) pair.
Uint32Map m_ulRxPackets
Number of UL RX Packets by (IMSI, LCID) pair.
bool m_firstWrite
true if output files have not been opened yet
std::string GetDlPdcpOutputFilename()
Get the name of the file where the downlink PDCP statistics will be stored.
uint32_t GetDlCellId(uint64_t imsi, uint8_t lcid)
Gets the attached Enb cellId.
double GetDlDelay(uint64_t imsi, uint8_t lcid)
Gets the downlink RLC to RLC delay.
void WriteUlResults(std::ofstream &outFile)
Writes collected statistics to UL output file and closes UL output file.
double GetUlDelay(uint64_t imsi, uint8_t lcid)
Gets the uplink RLC to RLC delay.
void SetUlPdcpOutputFilename(std::string outputFilename)
Set the name of the file where the uplink PDCP statistics will be stored.
Uint32Map m_ulCellId
List of UL CellIds by (IMSI, LCID) pair.
uint32_t GetUlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink packets.
Uint32Map m_dlCellId
List of DL CellIds by (IMSI, LCID) pair.
std::vector< double > GetUlDelayStats(uint64_t imsi, uint8_t lcid)
Gets the uplink RLC to RLC statistics: average, min, max and standard deviation.
Uint32Map m_dlTxPackets
Number of DL TX Packets by (IMSI, LCID) pair.
bool m_pendingOutput
true if any output is pending
static TypeId GetTypeId()
Register this type.
Uint64Map m_dlTxData
Amount of DL TX Data by (IMSI, LCID) pair.
void SetDlPdcpOutputFilename(std::string outputFilename)
Set the name of the file where the downlink PDCP statistics will be stored.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
Hold variables of type string.
Definition: string.h:56
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
AttributeValue implementation for Time.
Definition: nstime.h:1423
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeChecker > MakeStringChecker()
Definition: string.cc:30
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Definition: string.h:57
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1444
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1424
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ImsiLcidPair structure.
Definition: lte-common.h:63
uint8_t m_lcId
LCID.
Definition: lte-common.h:65
uint64_t m_imsi
IMSI.
Definition: lte-common.h:64
LteFlowId structure.
Definition: lte-common.h:43
uint8_t m_lcId
LCID.
Definition: lte-common.h:45
uint16_t m_rnti
RNTI.
Definition: lte-common.h:44
static const uint32_t packetSize
Packet size generated at the AP.