5G-LENA nr-v3.0-32-g83aee33
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-bearer-stats-calculator.h
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
3// Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4// Copyright (c) 2015, NYU WIRELESS, Tandon School of Engineering, New York University
5//
6// SPDX-License-Identifier: GPL-2.0-only
7
8#ifndef NR_RADIO_BEARER_STATS_CALCULATOR_H_
9#define NR_RADIO_BEARER_STATS_CALCULATOR_H_
10
11#include "nr-bearer-stats-simple.h"
12
13#include "ns3/basic-data-calculators.h"
14#include "ns3/lte-common.h"
15#include "ns3/object.h"
16#include "ns3/uinteger.h"
17
18#include <fstream>
19#include <map>
20#include <string>
21
22namespace ns3
23{
25typedef std::map<ImsiLcidPair_t, uint32_t> Uint32Map;
27typedef std::map<ImsiLcidPair_t, uint64_t> Uint64Map;
29typedef std::map<ImsiLcidPair_t, Ptr<MinMaxAvgTotalCalculator<uint32_t>>> Uint32StatsMap;
31typedef std::map<ImsiLcidPair_t, Ptr<MinMaxAvgTotalCalculator<uint64_t>>> Uint64StatsMap;
33typedef std::map<ImsiLcidPair_t, double> DoubleMap;
35typedef std::map<ImsiLcidPair_t, LteFlowId_t> FlowIdMap;
36
58{
59 public:
67 NrBearerStatsCalculator(std::string protocolType);
71 ~NrBearerStatsCalculator() override;
72 // Inherited from ns3::Object
77 static TypeId GetTypeId();
78 void DoDispose() override;
83 void SetStartTime(Time t);
88 Time GetStartTime() const;
93 void SetEpoch(Time e);
98 Time GetEpoch() const;
107 void UlTxPdu(uint16_t cellId,
108 uint64_t imsi,
109 uint16_t rnti,
110 uint8_t lcid,
111 uint32_t packetSize) override;
121 void UlRxPdu(uint16_t cellId,
122 uint64_t imsi,
123 uint16_t rnti,
124 uint8_t lcid,
125 uint32_t packetSize,
126 uint64_t delay) override;
135 void DlTxPdu(uint16_t cellId,
136 uint64_t imsi,
137 uint16_t rnti,
138 uint8_t lcid,
139 uint32_t packetSize) override;
149 void DlRxPdu(uint16_t cellId,
150 uint64_t imsi,
151 uint16_t rnti,
152 uint8_t lcid,
153 uint32_t packetSize,
154 uint64_t delay) override;
161 uint32_t GetUlTxPackets(uint64_t imsi, uint8_t lcid);
168 uint32_t GetUlRxPackets(uint64_t imsi, uint8_t lcid);
175 uint64_t GetUlTxData(uint64_t imsi, uint8_t lcid);
182 uint64_t GetUlRxData(uint64_t imsi, uint8_t lcid);
189 uint32_t GetUlCellId(uint64_t imsi, uint8_t lcid);
196 double GetUlDelay(uint64_t imsi, uint8_t lcid);
203 std::vector<double> GetUlDelayStats(uint64_t imsi, uint8_t lcid);
210 std::vector<double> GetUlPduSizeStats(uint64_t imsi, uint8_t lcid);
217 uint32_t GetDlTxPackets(uint64_t imsi, uint8_t lcid);
224 uint32_t GetDlRxPackets(uint64_t imsi, uint8_t lcid);
231 uint64_t GetDlTxData(uint64_t imsi, uint8_t lcid);
238 uint64_t GetDlRxData(uint64_t imsi, uint8_t lcid);
245 uint32_t GetDlCellId(uint64_t imsi, uint8_t lcid);
252 double GetDlDelay(uint64_t imsi, uint8_t lcid);
259 std::vector<double> GetDlDelayStats(uint64_t imsi, uint8_t lcid);
266 std::vector<double> GetDlPduSizeStats(uint64_t imsi, uint8_t lcid);
270 std::string GetUlOutputFilename();
274 std::string GetDlOutputFilename();
275
276 private:
283 void ShowResults();
289 void WriteUlResults(std::ofstream& outFile);
295 void WriteDlResults(std::ofstream& outFile);
299 void ResetResults();
304 void RescheduleEndEpoch();
310 void EndEpoch();
311
312 EventId m_endEpochEvent;
313 FlowIdMap m_flowId;
314 Uint32Map m_dlCellId;
315 Uint32Map m_dlTxPackets;
316 Uint32Map m_dlRxPackets;
317 Uint64Map m_dlTxData;
318 Uint64Map m_dlRxData;
319 Uint64StatsMap m_dlDelay;
320 Uint32StatsMap m_dlPduSize;
321 Uint32Map m_ulCellId;
322 Uint32Map m_ulTxPackets;
323 Uint32Map m_ulRxPackets;
324 Uint64Map m_ulTxData;
325 Uint64Map m_ulRxData;
326 Uint64StatsMap m_ulDelay;
327 Uint32StatsMap m_ulPduSize;
331 Time m_startTime;
335 Time m_epochDuration;
339 bool m_firstWrite;
343 bool m_pendingOutput;
347 std::string m_protocolType;
351 std::string m_dlRlcOutputFilename;
355 std::string m_ulRlcOutputFilename;
359 std::string m_dlPdcpOutputFilename;
363 std::string m_ulPdcpOutputFilename;
364 std::ofstream m_dlOutFile;
365 std::ofstream m_ulOutFile;
366};
367
368} // namespace ns3
369
370#endif /* NR_RADIO_BEARER_STATS_CALCULATOR_H_ */
std::vector< double > GetUlPduSizeStats(uint64_t imsi, uint8_t lcid)
void UlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) override
uint64_t GetDlTxData(uint64_t imsi, uint8_t lcid)
double GetUlDelay(uint64_t imsi, uint8_t lcid)
std::vector< double > GetDlDelayStats(uint64_t imsi, uint8_t lcid)
std::vector< double > GetDlPduSizeStats(uint64_t imsi, uint8_t lcid)
uint64_t GetUlTxData(uint64_t imsi, uint8_t lcid)
uint32_t GetDlCellId(uint64_t imsi, uint8_t lcid)
uint32_t GetDlRxPackets(uint64_t imsi, uint8_t lcid)
void DlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize) override
void UlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize) override
uint64_t GetDlRxData(uint64_t imsi, uint8_t lcid)
uint32_t GetUlCellId(uint64_t imsi, uint8_t lcid)
uint32_t GetUlTxPackets(uint64_t imsi, uint8_t lcid)
void DlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) override
double GetDlDelay(uint64_t imsi, uint8_t lcid)
uint32_t GetUlRxPackets(uint64_t imsi, uint8_t lcid)
uint64_t GetUlRxData(uint64_t imsi, uint8_t lcid)
std::vector< double > GetUlDelayStats(uint64_t imsi, uint8_t lcid)
uint32_t GetDlTxPackets(uint64_t imsi, uint8_t lcid)