Commit 3b81ec3b authored by Håvard Moås's avatar Håvard Moås
Browse files

Update IPFIXLIB to hopefully do last tweak on bandwidth calculation, havard.mork@gmail.com

git-svn-id: file:///home/svn/mapi/branches/haavardm-mapi@54 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 6aef0b4c
......@@ -416,14 +416,22 @@ static void calculateBitrate(u_int divisor, u_int64_t stamp, u_int64_t *lastupda
if(numSlotsAdvance > 0 || force) {
u_int32_t sum = 0;
for(i=0; i<BITRATE_AVERAGER_SLOTS; i++) {
sum += averager[i];
// Neither min nor max will have good values at endpoints
// (actually, max will, but it is guaranteed improved later)
if(averager[i]==MAX_UINT32) {
sum = MAX_UINT32;
break;
}
if(averager[i]==MAX_UINT32) {
// If forcing calculation, then always calculate the
// minimum and maximum. This is done to get a reading
// even for small flows also.
//
// In case of no-force, then break if a MAX_UINT32 is found.
// This is because we are observing the beginning of a flow
if(!force) {
sum = MAX_UINT32;
break;
}
} else
sum += averager[i];
}
// Retain 'sum', we need to know if its MAX_UINT32.
......@@ -438,6 +446,7 @@ static void calculateBitrate(u_int divisor, u_int64_t stamp, u_int64_t *lastupda
if(force)
return;
*lastupdate = stamp;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment