differv核心代码

此文件为dsredq.cc中的void redQueue::calcAvg(int prec, int m)函数:

三种不同的虚队列计算方式:RIO-C,RIO-D,MRED,其实他们就对队列的平均长度的计算方式不一样:

// void calcAvg(int prec, int m) // This method calculates avg queue length, given the prec number, // m (a value used to adjust the queue size appropriately during idle times). // If mredMode is rio_c, each virtual queue size is calculated independently. // If it is true, the calculated size of queue n includes the sizes of all // virtual queues up to and including n. void redQueue::calcAvg(int prec, int m) { float f; int i; f = qParam_[prec].edv_.v_ave; while (--m >= 1) { f *= 1.0 - qParam_[prec].edp_.q_w; } f *= 1.0 - qParam_[prec].edp_.q_w; if (mredMode == rio_c) for (i = 0; i <= prec; i ++) f += qParam_[i].edp_.q_w * qParam_[i].qlen; else if (mredMode == rio_d) f += qParam_[prec].edp_.q_w * qParam_[prec].qlen; else //wred f += qParam_[prec].edp_.q_w * q_->length(); if (mredMode == wred) for (i = 0; i < numPrec; i ++) qParam_[i].edv_.v_ave = f; else //rio_c, rio_d qParam_[prec].edv_.v_ave = f; }

你可能感兴趣的:(differv核心代码)