On Tue, Sep 10, 2002 at 11:21:55PM +0800, Fabio Mascio wrote:
> Hi Pavel,
> thank you very much for your patch, but I don't know if my email box
> can accept it, can I download from elsewhere?
Oh, it's "large" in terms of lines of code, actually it's going to be a
couple of kilobytes, I believe.
> About code I just mean that at 21st sample the sum is sum -= oldest->data;
> but as you say the delta time is recomputed ONLY at the top of the next iteration of the loop, so the 21sf sum does
> not has the bytes of the first sample (that furthermore they are NEVER added before so why subtract them now?) but the delta time is still calculated on 21 samples.
> If just the first time that i=21 oldest->data will be 0, the throughput will be computed over 21 samples but byte and time will be synchronized.
> Anyway I will give again a look to the code, maybe I'm falling in mistake.
Now I understand, you're right. dtime should be computed only after
the oldest pointer is modified. That even means that bytes and time are
not sychronized because by the time of tput computation, dtime still
spans back to the time the oldest packet arrived but the oldest packet's
data are already subtracted from the sum. As for the first segment's
data, the bug went unnoticed probably because the first segment will
usually be a SYN segment that tends to carry no data.
pvl