[bwm-tools-devel] COMMIT - r63 - in trunk: . bwmd include lib
Brought to you by:
nkukard
|
From: SVN C. <sv...@li...> - 2005-01-21 11:31:12
|
Author: nkukard
Date: 2005-01-21 13:30:59 +0200 (Fri, 21 Jan 2005)
New Revision: 63
Modified:
trunk/TODO
trunk/bwmd/autoclass.c
trunk/bwmd/flow.c
trunk/bwmd/ipq.c
trunk/include/flow.h
trunk/lib/xmlConf.c
Log:
* Made running totals a little softer
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2005-01-21 11:29:32 UTC (rev 62)
+++ trunk/TODO 2005-01-21 11:30:59 UTC (rev 63)
@@ -17,4 +17,3 @@
* bwm_firewall to generate automatic MARK values for flows
* fix findFlowByName & findGroupByName, these 2 functions are similar and i'm sure can be merged
* have the location of iptables-restore automatically discovered using ./configure, with override options
-* Change IPC mechanism used by bwmd and bwm_monitor to use more accurate flow->curThroughput
Modified: trunk/bwmd/autoclass.c
===================================================================
--- trunk/bwmd/autoclass.c 2005-01-21 11:29:32 UTC (rev 62)
+++ trunk/bwmd/autoclass.c 2005-01-21 11:30:59 UTC (rev 63)
@@ -172,6 +172,7 @@
* - PRIO 10
* - high drop probability
*/
+ prio = 10;
}
else if (tos == IPTOS_THROUGHPUT)
{
@@ -195,6 +196,7 @@
* - PRIO 90
* - high drop probability
*/
+ prio = 90;
}
return prio;
Modified: trunk/bwmd/flow.c
===================================================================
--- trunk/bwmd/flow.c 2005-01-21 11:29:32 UTC (rev 62)
+++ trunk/bwmd/flow.c 2005-01-21 11:30:59 UTC (rev 63)
@@ -296,16 +296,15 @@
g_mutex_lock(flow->lock);
- flow->running.pktCount++;
- flow->running.pktSize += PKT_SIZE(packet);
flow->curCredit -= PKT_SIZE(packet);
flow->accumThroughput += PKT_SIZE(packet);
+ flow->accumPackets++;
// If we can burst ...
if (flow->burstRate > 0)
flow->curBurstCredit -= PKT_SIZE(packet);
- // We bursted
+ // We bursted - this must be direct and not an average
if (bursted)
flow->running.pktBursted++;
@@ -323,23 +322,30 @@
{
float delta;
- // Get the fraction of time passed since last update, divide this by 1000000 to predict
- // approx values below if 1s had passed
+ // flow->curThroughputAge -= 2000000;
+
+ // Get the fraction of time passed since last update
delta = flow->curThroughputAge / 1000000.0;
- flow->curThroughputAge = 0;
// Calculate throughput
flow->curThroughput = (flow->curThroughput + (flow->accumThroughput / delta)) / 2;
+ flow->running.pktSize = flow->curThroughput;
flow->accumThroughput = 0;
- // Calculate average queue size
- flow->avgQueueSize = (flow->avgQueueSize + (flow->curQueueSize / delta)) / 2;
-#if 0
- fprintf(stderr,"%s: curThroughput: %f\tavgQueueSize:%u\n",
+ // Calculate packet rate
+ flow->curPacketRate = (flow->curPacketRate + (flow->accumPackets / delta)) / 2;
+ flow->running.pktCount = flow->curPacketRate;
+ flow->accumPackets = 0;
+
+ // Calculate queue size
+ flow->softQueueSize = (flow->softQueueSize + flow->curQueueSize) / 2;
+
+ if (strcmp(flow->flowName,"saix_in") == 0)
+ fprintf(stderr,"%s: curThroughput: %f\tsoftQueueSize:%u\n",
flow->flowName,
flow->curThroughput,
- flow->avgQueueSize);
-#endif
+ flow->softQueueSize);
+ flow->curThroughputAge = 0;
}
// Set this as the last time we updated our throughput
Modified: trunk/bwmd/ipq.c
===================================================================
--- trunk/bwmd/ipq.c 2005-01-21 11:29:32 UTC (rev 62)
+++ trunk/bwmd/ipq.c 2005-01-21 11:30:59 UTC (rev 63)
@@ -174,7 +174,7 @@
// FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size
maxQueueSize = P_FLOW(foundQueue,maxQueueSize);
curQueueSize = P_FLOW(foundQueue,curQueueSize);
- avgQueueSize = P_FLOW(foundQueue,avgQueueSize);
+ avgQueueSize = P_FLOW(foundQueue,softQueueSize);
// Check if we have limits to exceed
if (maxQueueSize && curQueueSize > 0 && avgQueueSize > 0)
Modified: trunk/include/flow.h
===================================================================
--- trunk/include/flow.h 2005-01-21 11:29:32 UTC (rev 62)
+++ trunk/include/flow.h 2005-01-21 11:30:59 UTC (rev 63)
@@ -110,21 +110,24 @@
struct pktStat_t counter; // This is the counter which is logged to file
GList *groups;
+ // Credit stuff... this is used in calculating current credit
double usCredit; // Credits for maxRate per microsecond
long int curCredit; // Current available credit for maxRate, if we burst we will be < 0
-
double usBurstCredit;
long int curBurstCredit; // Curent burstable credit available
+ // Throughput and internal stats
+ unsigned int curThroughputAge; // How many microseconds since last throughput update
+ struct timeval lastThroughputUpdate; // Last time the throughput was updated
unsigned int accumThroughput; // Accumulated throughput
+ unsigned int accumPackets; // Accumulated packets
float curThroughput; // Current throughput
- unsigned int curThroughputAge; // How many microseconds since last throughput update
- unsigned int avgQueueSize; // Average queue size
- struct timeval lastThroughputUpdate; // Last time the throughput was updated
+ unsigned int curPacketRate; // Current throughput
+ unsigned int softQueueSize; // Queue size
unsigned int accumMs; // Accumulated number of microseconds
struct timeval lastCreditCalc; // Last "timeval" that we calculated additional credit
- struct pktStat_t running; // This is the running counter
+ struct pktStat_t running; // This is the running counter used for stats & logging
int lastDumpTimestamp;
int counterTimeout; // STATIC - length between file logs
Modified: trunk/lib/xmlConf.c
===================================================================
--- trunk/lib/xmlConf.c 2005-01-21 11:29:32 UTC (rev 62)
+++ trunk/lib/xmlConf.c 2005-01-21 11:30:59 UTC (rev 63)
@@ -727,8 +727,10 @@
gettimeofday(&flow->lastThroughputUpdate,NULL);
flow->curThroughputAge = 0;
flow->accumThroughput = 0;
+ flow->accumPackets = 0;
flow->curThroughput = 0;
- flow->avgQueueSize = 0;
+ flow->curPacketRate = 0;
+ flow->softQueueSize = 0;
// Set last time we calculated credit and the rest...
flow->accumMs = 0;
gettimeofday(&flow->lastCreditCalc,NULL);
|