[bwm-tools-devel] COMMIT - r61 - in trunk: bwmd include lib
Brought to you by:
nkukard
From: SVN C. <sv...@li...> - 2005-01-21 09:35:12
|
Author: nkukard Date: 2005-01-21 11:34:56 +0200 (Fri, 21 Jan 2005) New Revision: 61 Modified: trunk/bwmd/flow.c trunk/include/flow.h trunk/lib/xmlConf.c Log: * Modified formula for getting average values, this one should be alot more precise Modified: trunk/bwmd/flow.c =================================================================== --- trunk/bwmd/flow.c 2005-01-21 09:00:31 UTC (rev 60) +++ trunk/bwmd/flow.c 2005-01-21 09:34:56 UTC (rev 61) @@ -299,7 +299,7 @@ flow->running.pktCount++; flow->running.pktSize += PKT_SIZE(packet); flow->curCredit -= PKT_SIZE(packet); - flow->curThroughput += PKT_SIZE(packet); + flow->accumThroughput += PKT_SIZE(packet); // If we can burst ... if (flow->burstRate > 0) @@ -319,28 +319,27 @@ flow->curThroughputAge += curTime.tv_usec - flow->lastThroughputUpdate.tv_usec; // 2 seconds - if (flow->curThroughputAge >= 2000000) + if (flow->curThroughputAge >= 250000) { float delta; - // flow->curThroughputAge -= 2000000; - - // Get the fraction of time passed since last update + // Get the fraction of time passed since last update, divide this by 1000000 to predict + // approx values below if 1s had passed delta = flow->curThroughputAge / 1000000.0; + flow->curThroughputAge = 0; // Calculate throughput - flow->curThroughput /= delta; - + flow->curThroughput = (flow->curThroughput + (flow->accumThroughput / delta)) / 2; + flow->accumThroughput = 0; + // Calculate average queue size - flow->avgQueueSize = (flow->avgQueueSize + flow->curQueueSize) / delta; - /* - fprintf(stderr,"%s: curThroughput: %f, avgQueueSize: %li, delta: %f\n", + flow->avgQueueSize = (flow->avgQueueSize + (flow->curQueueSize / delta)) / 2; +#if 0 + fprintf(stderr,"%s: curThroughput: %f\tavgQueueSize:%u\n", flow->flowName, flow->curThroughput, - flow->avgQueueSize, - delta); - */ - flow->curThroughputAge = 0; + flow->avgQueueSize); +#endif } // Set this as the last time we updated our throughput @@ -445,7 +444,8 @@ // Check if we havn't already gotten the queue listed // FIXME: check if we can't just add, high flow queue if (!g_list_find(runnerData->queueChangeList[pktQueue->prio],pktQueue)) - runnerData->queueChangeList[pktQueue->prio] = g_list_append(runnerData->queueChangeList[pktQueue->prio],pktQueue); + runnerData->queueChangeList[pktQueue->prio] = g_list_append( + runnerData->queueChangeList[pktQueue->prio],pktQueue); g_cond_signal(runnerData->bandSignalCond); g_mutex_unlock(runnerData->bandSignalLock); } Modified: trunk/include/flow.h =================================================================== --- trunk/include/flow.h 2005-01-21 09:00:31 UTC (rev 60) +++ trunk/include/flow.h 2005-01-21 09:34:56 UTC (rev 61) @@ -116,6 +116,7 @@ double usBurstCredit; long int curBurstCredit; // Curent burstable credit available + unsigned int accumThroughput; // Accumulated throughput float curThroughput; // Current throughput unsigned int curThroughputAge; // How many microseconds since last throughput update unsigned int avgQueueSize; // Average queue size Modified: trunk/lib/xmlConf.c =================================================================== --- trunk/lib/xmlConf.c 2005-01-21 09:00:31 UTC (rev 60) +++ trunk/lib/xmlConf.c 2005-01-21 09:34:56 UTC (rev 61) @@ -726,6 +726,7 @@ // Setup throughput stuff... gettimeofday(&flow->lastThroughputUpdate,NULL); flow->curThroughputAge = 0; + flow->accumThroughput = 0; flow->curThroughput = 0; flow->avgQueueSize = 0; // Set last time we calculated credit and the rest... |