cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Again: progress, stats

From: Daniel Stenberg <Daniel.Stenberg_at_haxx.nu>
Date: Wed, 01 Mar 2000 14:23:01 +0100

Georg Horn wrote:

> most of the statistics
> stuff i want to do with curl can be done with the -s and the new -w option.
> (-s: no stats at all, -s -w blah: just a summary at the end, -w blah:
> progress meter and summary)

Well that's something at least! ;-)

> - I like the -w option, but i think that the output should be printed to
> stderr, where the progress meter too goes to, as it otherwise is appended
> to the downloaded file.

I am not so sure about that. The progress meter is passed to stderr to
make it separatable from the output stream and because no one would ever
want to capture that data and do something with it (introducing -W may
change that).

The -w data is a totally different story. People will use that option just
because they have some specific information they want. Stderr is not a
suitable stream for normal information.

Of course, there's a problem if you want to download a file to stdout as
well as sending -w there, but why send the file to stdout then? curl
offers a lot of options that reads stdin or writes to stdout, it is all up
to the user to select how the output should be delt with.

> - It would be very nice to have an option (capital W?) that allows you to
> specify the format of the progress meter lines.

I've been playing with that thought. I don't think it would be too
difficult to add.

> - Another nice thing would be to be able to specify the printf() format of the
> variables, for example: -W '%{received:%9.3f}'. Background is, that you can
> get the absolute number of bytes received so far every second, and not the
> string '11M' for dozens of seconds... If no format is given, the max5data()
> result could be used as default. Or a special format string could be used for
> this.

I was afraid of this! ;-)

Of course what would be handy when you want to create a good-looking
progress meter. The question is, if that is what we want to enable or
think that people will want/use.

If that is what we want, then we definitely need a way to format the
output. I think having a special format string for the 'max5' option would
make sense. I could even consider a 'max=X' thing in that case.

However, I can't see the point in making your own progress meter for any
other purpose than getting statistical, mainly machine-parseable,
information. And then I would think that plain 'seconds' and 'bytes' would
be enough.

Anyone else have ideas or opinions?

> - Does it make sense to output the progress meter every second, but calculate
> the current speed as the average of the last 5 seconds?

I think it does. The speed generally varies too much from second to second
for that to be an interesting number (or I'd need to lowpass filter it,
which would be pretty much what I do today), while the average speed
during the whole transfer is a bit too unspecific.

> I think this gives no
> correct representation of the current speed, as it lasts about 5 seconds
> until the currend speed gets close to the real speed. Does it make sense to
> make this interval configurable?

Why would anyone be so picky about the speed the first five seconds? The
progress meter is mainly a show to display a little what's going on and
how long time you can expect to wait until its done. If you want to make
decisions and actions depending on the results, I don't see why you
couldn't just use the upcoming -W option and just calculate whatever you
want with help from the information provided?

Why is Curl's internally calculated "current" speed that important?

--
   Daniel Stenberg - http://www.contactor.se/~dast - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on 2000-03-01