[bwm-tools-devel] COMMIT - r12 - trunk/lib
Brought to you by:
nkukard
From: <bwm...@li...> - 2004-12-29 10:39:31
|
Author: nkukard Date: 2004-12-29 12:39:07 +0200 (Wed, 29 Dec 2004) New Revision: 12 Modified: trunk/lib/flow.c trunk/lib/ipq.c Log: * Removed a whole bunch of debugging printf's Modified: trunk/lib/flow.c =================================================================== --- trunk/lib/flow.c 2004-12-29 10:33:18 UTC (rev 11) +++ trunk/lib/flow.c 2004-12-29 10:39:07 UTC (rev 12) @@ -179,19 +179,19 @@ pktQueue->packets = NULL; } - printf("Flow added...\n"); - printf(" flowName - %s\n",flowName); - printf(" parent - %p\n",parentFlow); - printf(" nfmark - %li\n",nfmark); - printf(" statsLen - %li\n",flow->statsLen); - printf(" maxQueueSize - %li\n",flow->maxQueueSize); - printf(" maxQueueLen - %li\n",flow->maxQueueLen); - printf(" maxRate - %li\n",flow->maxRate); - printf(" usCredit - %.6f\n",flow->usCredit); - printf(" curCredit - %u\n",flow->curCredit); - printf(" usBurstCredit - %.6f\n",flow->usBurstCredit); - printf(" curBurstCredit - %u\n",flow->curBurstCredit); - printf(" burstRate - %li\n",flow->burstRate); +// printf("Flow added...\n"); +// printf(" flowName - %s\n",flowName); +// printf(" parent - %p\n",parentFlow); +// printf(" nfmark - %li\n",nfmark); +// printf(" statsLen - %li\n",flow->statsLen); +// printf(" maxQueueSize - %li\n",flow->maxQueueSize); +// printf(" maxQueueLen - %li\n",flow->maxQueueLen); +// printf(" maxRate - %li\n",flow->maxRate); +// printf(" usCredit - %.6f\n",flow->usCredit); +// printf(" curCredit - %u\n",flow->curCredit); +// printf(" usBurstCredit - %.6f\n",flow->usBurstCredit); +// printf(" curBurstCredit - %u\n",flow->curBurstCredit); +// printf(" burstRate - %li\n",flow->burstRate); // printf("Queue Stuff:\n"); // printf(" min_th - %li\n",flow->min_th); // printf(" max_th - %li\n",flow->max_th); @@ -485,24 +485,13 @@ /* Check if we will exceed our burst credit */ if ((i = burst_credit_will_exceed(flow,PKT_SIZE(packet)))) - { ok = 0; - fprintf(stderr,"%s(%i): res = %i, Will exceed for %s (%i:%i:%i:%i)\n",__FILE__,__LINE__, - i,flow->flowName, - flow->maxRate,flow->curCredit,flow->burstRate,flow->curBurstCredit); - } else - { // Guess we didn't, we bursted bursted = 1; - fprintf(stderr,"%s(%i): res = %i, Bursted to parent %s\n",__FILE__,__LINE__,i,flow->flowName); - } } else - { - fprintf(stderr,"%s(%i): Will exceed for %s\n",__FILE__,__LINE__,flow->flowName); ok = 0; - } } // If we have a parent, if we do... do a few tests @@ -510,10 +499,7 @@ { // Check if we havn't exceeded our parent queues if (will_exceed_flow_queue(flow->parent,PKT_SIZE(packet))) - { ok = 0; - fprintf(stderr,"%s: Will exceed @ %i\n",flow->flowName,__LINE__); - } /* * if (....) - if we here because of bursting, check if we have a @@ -541,20 +527,14 @@ { if (flow->parent_th > 0 && flow->parent_th < (flow->parent->curThroughput / (double) flow->parent->burstRate) * 100.0) - { ok = 0; - fprintf(stderr,"%s: Will exceed @ %i\n",flow->flowName,__LINE__); - } } // If not, against the maxRate else if (flow->parent->maxRate > 0) { if (flow->parent_th > 0 && flow->parent_th < (flow->parent->curThroughput / (double) flow->parent->maxRate) * 100.0) - { ok = 0; - fprintf(stderr,"%s: Will exceed @ %i\n",flow->flowName,__LINE__); - } } } } @@ -563,6 +543,9 @@ // If packet is still ok to pass through, do our stuff if (ok) { + struct timeval curTime; + + g_mutex_lock(flow->lock); flow->running.pktCount++; @@ -578,36 +561,26 @@ if (bursted) flow->running.pktBursted++; - // Update our throughput - { - struct timeval curTime; - - // Grab exact time now - gettimeofday(&curTime,NULL); + // Grab exact time now + gettimeofday(&curTime,NULL); - - // Add up accumulated time - if (curTime.tv_sec - flow->lastThroughputUpdate.tv_sec > 0) - flow->curThroughputAge += (curTime.tv_sec - flow->lastThroughputUpdate.tv_sec) * 1000000; - else - flow->curThroughputAge += curTime.tv_usec - flow->lastThroughputUpdate.tv_usec; + // Add up accumulated time + if (curTime.tv_sec - flow->lastThroughputUpdate.tv_sec > 0) + flow->curThroughputAge += (curTime.tv_sec - flow->lastThroughputUpdate.tv_sec) * 1000000; + else + flow->curThroughputAge += curTime.tv_usec - flow->lastThroughputUpdate.tv_usec; - // 2 seconds - if (flow->curThroughputAge >= 2000000) - { - flow->curThroughputAge -= 2000000; - flow->curThroughput = flow->curThroughputAge / 1000000.0 * flow->curThroughput; - } + // 2 seconds + if (flow->curThroughputAge >= 2000000) + { + flow->curThroughputAge -= 2000000; + flow->curThroughput = flow->curThroughputAge / 1000000.0 * flow->curThroughput; + } - fprintf(stderr,"%s: throughput: %i/%f\n",flow->flowName,flow->curThroughputAge,flow->curThroughput); - - // Set this as the last time we updated our throughput - gettimeofday(&flow->lastThroughputUpdate,NULL); + // Set this as the last time we updated our throughput + gettimeofday(&flow->lastThroughputUpdate,NULL); + - } - - fprintf(stderr,"%s: Current throughput = %f\n",flow->flowName,flow->curThroughput); - g_mutex_unlock(flow->lock); // Time to update our groups @@ -640,7 +613,6 @@ packets = g_list_remove(packets,packet); // Save the size i = PKT_SIZE(packet); - // FIXME - UPDATE GROUPS // "Free" the packet g_mutex_lock(runnerData->pmem.lock); runnerData->pmem.freeList = g_list_append(runnerData->pmem.freeList,packet); @@ -656,7 +628,6 @@ struct pktQueue_t *nextPktQueue = flow->pktQueues[pktQueue->prio]; - fprintf(stderr,"Overflowing to %s...\n",flow->flowName); // We can do this before locking queuedLen++; queuedSize += PKT_SIZE(packet); @@ -716,9 +687,6 @@ g_mutex_unlock(pktQueue->lock); - // Quickly and update everything in between -//FIXME!!!!! updateGroups(runnerData,flow,1,i,0,0); - return(acceptLen); } @@ -742,7 +710,6 @@ // Check if we found a flow with a queue pktsProcessed += processPktQueue(aRunnerData,pktQueue); -// printf("%i packets processed\n",pktsProcessed); } Modified: trunk/lib/ipq.c =================================================================== --- trunk/lib/ipq.c 2004-12-29 10:33:18 UTC (rev 11) +++ trunk/lib/ipq.c 2004-12-29 10:39:07 UTC (rev 12) @@ -197,10 +197,7 @@ // Check first of all if we fucked over our one of our queue limits if (will_exceed_pkt_queue(foundQueue,PKT_SIZE(packet)) || will_exceed_flow_queue(foundQueue->parentFlow,PKT_SIZE(packet))) - { drop = 1; - fprintf(stderr,"%s: Will exceed @ %i\n",foundQueue->parentFlow->flowName,__LINE__); - } #if 0 @@ -225,8 +222,6 @@ // Check if we must pass the packet if (!drop) { - fprintf(stderr,"%s: Queuing packet @ %i, queue size = %i, queue len = %i\n",foundQueue->parentFlow->flowName,__LINE__, - foundQueue->curSize,foundQueue->curLen); // Lock, queue... adjust stats foundQueue->packets = g_list_append(foundQueue->packets,packet); foundQueue->curSize += PKT_SIZE(packet); |