[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CPS/throttle patches



On 11 Jun 2002 00:29:19 -0500
Charlie Hubbard <chubbard16@mit.midco.net> wrote:

> average-rate = 0.9*(average-rate) + 0.1*(gain in last second)
> 
> Start the transfer with an initial average-rate of 0 and over the next
> 10 seconds it will increase to the average over the last 10 seconds.
> Then it will remain at the average over the last 10 seconds for the rest
> of the transfer.  If 10 seconds is too long or too short of an average
> interval, change the value used for 'a'.  If you record gains at an
> interval different than 1 second, you'll need to normalize it to
> bytes/second before using it in the calculation (but 1 second
> measurement on the gains seems reasonable).
> 
> Anyway, just a thought.
> 
> 
> Paydon

That sounds even simpler. Though, I think it's better to start the
rate/cps as the gain at time(1), so the rate is almost right even in the first
ten seconds.

Allthough, I can't figure out why I get different numbers.

time	pos	gain
1	4096	4096	cps = 4096
2	8192	4096	cps = 0.833*(4096) + 0.166*(4096) = 4096
3	10000	1808	cps = 0.833*(4096) + 0.166*(1808) = 3714
4	12000	2000	cps = 0.833*(3714) + 0.166*(2000) = 3427
5	17000	5000	cps = 0.833*(3427) + 0.166*(5000) = 3688
6	20000	3000	cps = 0.833*(3688) + 0.166*(3000) = 3572


> > time	pos	gain
> > 0	0	0
> > 1	4096	4096
> > 2	8192	4096
> > 3	10000	1808
> > 4	12000	2000
> > 5	17000	5000
> > 6	20000	3000
> > 
> > cps = (4096 + 4096 + 1808 + 2000 + 5000 + 3000) / 6
> > cps = 3333


Close, but ~200 cps off...


-- 
Peter Zelezny.
--
XChat-discuss: mailing list for XChat users
Archive:       http://mail.nl.linux.org/xchat-discuss/