From owner-freebsd-bugs Wed Sep 15 7:46:56 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from dt014nb6.san.rr.com (dt014nb6.san.rr.com [24.30.129.182]) by hub.freebsd.org (Postfix) with ESMTP id 9A97C1515E for ; Wed, 15 Sep 1999 07:45:48 -0700 (PDT) (envelope-from Doug@gorean.org) Received: from gorean.org (master [10.0.0.2]) by dt014nb6.san.rr.com (8.9.3/8.8.8) with ESMTP id IAA13094; Wed, 15 Sep 1999 08:02:23 -0700 (PDT) (envelope-from Doug@gorean.org) Message-ID: <37DFB38D.F10DE30D@gorean.org> Date: Wed, 15 Sep 1999 07:56:13 -0700 From: Doug Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.61 [en] (X11; U; FreeBSD 4.0-CURRENT-0913 i386) X-Accept-Language: en MIME-Version: 1.0 To: adrian@ip.versatel.net Cc: FreeBSD-bugs@freebsd.org Subject: Re: bin/13758: adding current download throughput output to fetch(1) References: <19990915132634.7794.qmail@ewok.creative.net.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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