From: Merciadri Luca on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

It sometimes happen, e.g. with wget downloading from slow servers,
that download speed falls down to 0. After this sudden (or
progressive) drop, how can ETA still be estimated? What is it based
on? Is an interpolation of the $n$ last DL speeds achieved, and then
reused in some way?

Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --

Listen to many, speak to a few. (William Shakespeare)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkvtlg8ACgkQM0LLzLt8MhxE9gCeJ6xpRC52jkGGsboKv98tZQED
jR0An3/0WrXIoi1G1b/0e3Pc7iu+uKg4
=NoFO
-----END PGP SIGNATURE-----
From: Tim Little on
On 2010-05-14, Merciadri Luca <Luca.Merciadri(a)student.ulg.ac.be> wrote:
> It sometimes happen, e.g. with wget downloading from slow servers,
> that download speed falls down to 0. After this sudden (or
> progressive) drop, how can ETA still be estimated?

If you look at a download closely enough, it is usually reasonably
well modelled as "spikes" of essentially unlimited download speed with
interspersed periods of zero download speed. E.g. the program waits
10 milliseconds in a read() or select() call then receives a packet of
1500 bytes in a single hit. The program has no way of knowing whether
more data is streaming into an OS or network hardware buffer while it
processes that packet.

So any notion of "download speed" is already going to be some sort of
average, by necessity. Any sort of ETA is likewise going to be based
on an average of some sort. Different programs use different forms of
average. If you're interested in the algorithm used by "wget" in
particular, you're in luck: it's open-source, and so you can easily
read the source code.


- Tim
From: Merciadri Luca on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim Little <tim(a)little-possums.net> writes:

> On 2010-05-14, Merciadri Luca <Luca.Merciadri(a)student.ulg.ac.be> wrote:
>> It sometimes happen, e.g. with wget downloading from slow servers,
>> that download speed falls down to 0. After this sudden (or
>> progressive) drop, how can ETA still be estimated?
>
> If you look at a download closely enough, it is usually reasonably
> well modelled as "spikes" of essentially unlimited download speed with
> interspersed periods of zero download speed. E.g. the program waits
> 10 milliseconds in a read() or select() call then receives a packet of
> 1500 bytes in a single hit. The program has no way of knowing whether
> more data is streaming into an OS or network hardware buffer while it
> processes that packet.
>
> So any notion of "download speed" is already going to be some sort of
> average, by necessity. Any sort of ETA is likewise going to be based
> on an average of some sort. Different programs use different forms of
> average. If you're interested in the algorithm used by "wget" in
> particular, you're in luck: it's open-source, and so you can easily
> read the source code.
Nice idea.

Here is an excerpt from src/progress.c:

==
/* Display ETA based on average speed. Inspired by Vladi
Belperchinov-Shabanski's "wget-new-percentage" patch. */
if (dp->total_length)
{
wgint bytes_remaining = dp->total_length - bytes_displayed;
/* The quantity downloaded in this download run. */
wgint bytes_sofar = bytes_displayed - dp->initial_length;
double eta = dltime * bytes_remaining / bytes_sofar;
if (eta < INT_MAX - 1)
logprintf (LOG_VERBOSE, " %s",
eta_to_human_short ((int) (eta + 0.5), true));
}
==
According to this, as bytes_remaining / bytes_sofar is constant if the
connection is down, but as dltime increases by one unit at each time
unit, the ETA only depends on dltime.


- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --

Courage doesn't always roar. Sometimes courage is the little voice at the end of the day that says I'll try again tomorrow. (Mary Anne Radmacher)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkvwF9AACgkQM0LLzLt8MhxaBACfTt78h0SIxwRik7mq0F+mqkCi
9a4AnA/yzULAOjLJYHJemHb4KJF8q2bj
=qqVu
-----END PGP SIGNATURE-----