From e2d608f9137d8f65c1ad148fa5184be917d72d32 Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Mon, 30 May 2011 17:23:39 +0200 Subject: [PATCH] PfFfMacScheduler add m_flowStatsUl --- src/lte/model/pf-ff-mac-scheduler.cc | 66 +++++++++++++++++++++------- src/lte/model/pf-ff-mac-scheduler.h | 7 ++- 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index c77745dbf..3cd1889fa 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -294,16 +294,22 @@ PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch std::map ::iterator it; for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++) { - it = m_flowStats.find (params.m_rnti); + it = m_flowStatsDl.find (params.m_rnti); - if (it == m_flowStats.end ()) + if (it == m_flowStatsDl.end ()) { - pfsFlowPerf_t flowStats; - flowStats.flowStart = Simulator::Now (); - flowStats.totalBytesTransmitted = 0; - flowStats.lastTtiBytesTrasmitted = 0; - flowStats.lastAveragedThroughput = 1; - m_flowStats.insert (std::pair (params.m_rnti, flowStats)); + pfsFlowPerf_t flowStatsDl; + flowStatsDl.flowStart = Simulator::Now (); + flowStatsDl.totalBytesTransmitted = 0; + flowStatsDl.lastTtiBytesTrasmitted = 0; + flowStatsDl.lastAveragedThroughput = 1; + m_flowStatsDl.insert (std::pair (params.m_rnti, flowStatsDl)); + pfsFlowPerf_t flowStatsUl; + flowStatsUl.flowStart = Simulator::Now (); + flowStatsUl.totalBytesTransmitted = 0; + flowStatsUl.lastTtiBytesTrasmitted = 0; + flowStatsUl.lastAveragedThroughput = 1; + m_flowStatsUl.insert (std::pair (params.m_rnti, flowStatsUl)); } else { @@ -427,9 +433,9 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched { // NS_LOG_DEBUG (this << " ALLOCATION for RBG " << i << " of " << rbgNum); std::map ::iterator it; - std::map ::iterator itMax = m_flowStats.end (); + std::map ::iterator itMax = m_flowStatsDl.end (); double rcqiMax = 0.0; - for (it = m_flowStats.begin (); it != m_flowStats.end (); it++) + for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++) { std::map ::iterator itCqi; itCqi = m_a30CqiRxed.find ((*it).first); @@ -463,7 +469,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched } // end if cqi } // end for m_rlcBufferReq - if (itMax == m_flowStats.end ()) + if (itMax == m_flowStatsDl.end ()) { // no UE available for this RB NS_LOG_DEBUG (this << " no UE found"); @@ -489,7 +495,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // reset TTI stats of users std::map ::iterator itStats; - for (itStats = m_flowStats.begin (); itStats != m_flowStats.end (); itStats++) + for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++) { (*itStats).second.lastTtiBytesTrasmitted = 0; } @@ -575,8 +581,8 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // update UE stats std::map ::iterator it; - it = m_flowStats.find ((*itMap).first); - if (it != m_flowStats.end()) + it = m_flowStatsDl.find ((*itMap).first); + if (it != m_flowStatsDl.end()) { (*it).second.lastTtiBytesTrasmitted = tbSize; // NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted); @@ -594,7 +600,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // update UEs stats - for (itStats = m_flowStats.begin (); itStats != m_flowStats.end (); itStats++) + for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++) { (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTrasmitted; // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley) @@ -702,6 +708,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched FfMacSchedSapUser::SchedUlConfigIndParameters ret; std::vector rbgAllocationMap; + std::map ::iterator itStats; if (m_nextRntiUl!=0) { for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) @@ -793,6 +800,22 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched uldci.m_freqHopping = 0; uldci.m_pdcchPowerOffset = 0; // not used ret.m_dciList.push_back (uldci); + + // update TTI UE stats + itStats = m_flowStatsUl.find ((*it).first); + if (itStats != m_flowStatsUl.end()) + { + (*itStats).second.lastTtiBytesTrasmitted = uldci.m_tbSize; + // NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted); + + + } + else + { + NS_LOG_DEBUG (this << " No Stats for this allocated UE"); + } + + it++; if (it==m_ceBsrRxed.end ()) { @@ -806,6 +829,19 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched break; } } while ((*it).first != m_nextRntiUl); + + + // Update global UE stats + // update UEs stats + for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++) + { + (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTrasmitted; + // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley) + (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTrasmitted / 0.001)); + // NS_LOG_DEBUG (this << " UE tot bytes " << (*itStats).second.totalBytesTransmitted); + // NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput); + (*itStats).second.lastTtiBytesTrasmitted = 0; + } m_allocationMaps.insert (std::pair > (params.m_sfnSf, rbgAllocationMap)); m_schedSapUser->SchedUlConfigInd (ret); return; diff --git a/src/lte/model/pf-ff-mac-scheduler.h b/src/lte/model/pf-ff-mac-scheduler.h index f660a1d81..91ac295ad 100644 --- a/src/lte/model/pf-ff-mac-scheduler.h +++ b/src/lte/model/pf-ff-mac-scheduler.h @@ -136,10 +136,15 @@ private: std::map m_rlcBufferReq; + /* + * Map of UE statistics (per RNTI basis) in downlink + */ + std::map m_flowStatsDl; + /* * Map of UE statistics (per RNTI basis) */ - std::map m_flowStats; + std::map m_flowStatsUl; /*