Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
bwmtools
bwmtools
Commits
fb7b4769
Commit
fb7b4769
authored
Jan 21, 2005
by
Nigel Kukard
Browse files
* Modified formula for getting average values, this one should be alot more precise
parent
0c6fe385
Changes
3
Hide whitespace changes
Inline
Side-by-side
bwmd/flow.c
View file @
fb7b4769
...
...
@@ -299,7 +299,7 @@ static int processPktQueue(struct runnerData_t *runnerData, struct pktQueue_t *p
flow
->
running
.
pktCount
++
;
flow
->
running
.
pktSize
+=
PKT_SIZE
(
packet
);
flow
->
curCredit
-=
PKT_SIZE
(
packet
);
flow
->
cu
r
Throughput
+=
PKT_SIZE
(
packet
);
flow
->
ac
cu
m
Throughput
+=
PKT_SIZE
(
packet
);
// If we can burst ...
if
(
flow
->
burstRate
>
0
)
...
...
@@ -319,28 +319,27 @@ static int processPktQueue(struct runnerData_t *runnerData, struct pktQueue_t *p
flow
->
curThroughputAge
+=
curTime
.
tv_usec
-
flow
->
lastThroughputUpdate
.
tv_usec
;
// 2 seconds
if
(
flow
->
curThroughputAge
>=
2
00
0000
)
if
(
flow
->
curThroughputAge
>=
2
5
0000
)
{
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
\t
avgQueueSize:
%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 @@ static int processPktQueue(struct runnerData_t *runnerData, struct pktQueue_t *p
// 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
);
}
...
...
include/flow.h
View file @
fb7b4769
...
...
@@ -116,6 +116,7 @@ struct flow_t
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
...
...
lib/xmlConf.c
View file @
fb7b4769
...
...
@@ -726,6 +726,7 @@ static struct flow_t* createFlow(
// 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...
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment