MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / macComputeUtilization

Method macComputeUtilization

GPRS/MAC.cpp:2097–2126  ·  view source on GitHub ↗

Compute a measure of GPRS channel utilization so we can decide when we need more bandwidth. For now we will compute only downlink bandwidth and ignore uplink. You cant just count how many RLC blocks are in TBFs, because the associated MS could be stalled and the TBF may not be using any bandwidth. The utilization is the approximate number of TBFs that are waiting to send blocks now, so 1.0 means t

Source from the content-addressed store, hash-verified

2095// probably fully utilize two channels, at least at this instant.
2096// Return the utilization.
2097float L2MAC::macComputeUtilization()
2098{
2099 ScopedLock lock(macLock); // This function called from CLI.
2100 int numReady = 0;
2101 float utilization = 0.0; // Desired downlink utilization at this moment.
2102 TBF *tbf;
2103 RN_MAC_FOR_ALL_TBF(tbf) {
2104 switch (tbf->mtGetState()) {
2105 case TBFState::DataReadyToConnect:
2106 case TBFState::DataWaiting1:
2107 case TBFState::DataWaiting2:
2108 numReady++; // These TBFs are waiting to send a message.
2109 continue;
2110 case TBFState::DataTransmit:
2111 case TBFState::DataReassign:
2112 //case TBFState::DataStalled:
2113 utilization += tbf->engineDesiredUtilization();
2114 continue;
2115 default: continue;
2116 }
2117 }
2118 utilization += numReady;
2119
2120 // We want to average the utilization over some timespan.
2121 // This number should be picked to match the delay we use before closing
2122 // GPRS chanels, whatever that will be.
2123 const unsigned NumFramesToAverage = 48*5; // roughly 5 seconds worth of RLC blocks.
2124 return macDownlinkUtilization =
2125 (utilization + macDownlinkUtilization * (NumFramesToAverage-1)) / NumFramesToAverage;
2126}
2127
2128void L2MAC::macCheckChannels()
2129{

Callers 1

printStatsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected