float TCountDownClock::CalculateTransferRate(float fOverallAvg)
{
long lAvgWeight;
float fWeightedRecentAvg;
// the weighting for the recent average
// is always 3. Calculate the weight for
// the overall average
lAvgWeight = m_lIntervalCount / kHistoryEntries;
// compute the weighted average of recent
// transfer rates
fWeightedRecentAvg = WeighRecentRates();
// return the overall weighted average
// transfer rate in bytes/second
return (
(fWeightedRecentAvg * 3 +
fOverallAvg * lAvgWeight) /
(float)(3 + lAvgWeight)
);
}
// ----------------------------------------------