For the maxing out issue you could use a ring buffer and a sum variable. Let me try to explain.
1. Create an array of a selected size, lets say size 20 for example
2. Create a variable that calculates the sum.
3. Create help variables
4. Start looping and calculating.
In this way you always have for example a X minute average, no problem with maxing out some variable. Please ask if there was something unclear in my code. The code here is written in C but there should be no problem to change it to VB.
int sizeOfBuf = 20;
double insfe_buf = new double[sizeOfBuf];
double insfe_sum = 0;
double fe_avg = 0;
int bufCnt = 0;
int avg_divisor = 1;
bool firstBufLoop = true;
insfe_sum -= insfe_buf[bufCnt]; // remove oldest insfe value from sum
insfe_buf[buffCnt] = insfe; // add newest insfe
insfe_sum += insfe_buf[bufCnt]; // add newest insfe to sum
bufCnt = (bufCnt + 1) % sizeOfBuf; // Do the increment 0..19 (0..sizeOfBuf)
if(bufCnt < sizeOfBuf - 1)
avg_divisor = bufCnt + 1;
avg_divisor = sizeOfBuf;
firstBufLoop = false;
fe_avg = insfe_sum / avg_divisor;