Date: Wed, 15 Sep 1999 07:56:13 -0700 From: Doug <Doug@gorean.org> To: adrian@ip.versatel.net Cc: FreeBSD-bugs@freebsd.org Subject: Re: bin/13758: adding current download throughput output to fetch(1) Message-ID: <37DFB38D.F10DE30D@gorean.org> References: <19990915132634.7794.qmail@ewok.creative.net.au>
next in thread | previous in thread | raw e-mail | index | archive | help
adrian@creative.net.au wrote: > I thought it might be useful to have fetch(1) return a 'current throughput' > indicator so I could see how fast the download is. Overall I think that's a good idea, so please don't take these criticisms the wrong way . > fprintf (stderr, "\r%s: %2qd%%", s, (long long)(100*bytes/size)); > else > fprintf (stderr, "\r%s: %qd Kbytes", s, (long long)(bytes/1024)); > + speed = ((float)bytes - (float)lastbc) / 5.0; > + lastbc = bytes; > + if (speed > 1000.0) > + fprintf(stderr, " (%.2f Kbytes/s)", speed / 1000.0); > + else > + fprintf(stderr, " (%.0f bytes/s)", speed); > } > } First, if you look carefully at the code above yours you can see that the proper divisor for KiloBytes is 1024, not 1000. However, that begs a couple of questions. First, since it's bytes and not bits that are being displayed, shouldn't it be KBytes (in both places) instead of Kbytes? And since we're measuring bandwidth and not character storage, shouldn't the measurement be bits and not bytes? Thank you for your contribution, Doug To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37DFB38D.F10DE30D>