From owner-svn-src-all@FreeBSD.ORG Sun Dec 9 19:53:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F3341631; Sun, 9 Dec 2012 19:53:56 +0000 (UTC) (envelope-from flo@smeets.im) Received: from mail.solomo.de (mail.solomo.de [5.9.87.18]) by mx1.freebsd.org (Postfix) with ESMTP id 7241C8FC14; Sun, 9 Dec 2012 19:53:56 +0000 (UTC) Received: from cpos1.nexxtmobile.de (localhost [127.0.0.1]) by mail.solomo.de (Postfix) with ESMTP id 867241214; Sun, 9 Dec 2012 20:53:54 +0100 (CET) X-Virus-Scanned: amavisd-new at nexxtmobile.de Received: from mail.solomo.de ([127.0.0.1]) by cpos1.nexxtmobile.de (cpos1.nexxtmobile.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id r-MBOwv5F49L; Sun, 9 Dec 2012 20:53:52 +0100 (CET) Received: from nibbler-osx.local (b2b-92-50-66-163.unitymedia.biz [92.50.66.163]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.solomo.de (Postfix) with ESMTPSA id F1BD3120B; Sun, 9 Dec 2012 20:53:51 +0100 (CET) Message-ID: <50C4EC4E.6060006@smeets.im> Date: Sun, 09 Dec 2012 20:53:50 +0100 From: Florian Smeets User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Thunderbird/20.0a1 MIME-Version: 1.0 To: Mateusz Guzik Subject: Re: svn commit: r243147 - head/usr.bin/fetch References: <201211161205.qAGC5Bwr081144@svn.freebsd.org> <50C4D31E.4080000@smeets.im> <20121209182730.GA28989@dft-labs.eu> <50C4DB7A.9050302@smeets.im> <20121209190120.GB28989@dft-labs.eu> In-Reply-To: <20121209190120.GB28989@dft-labs.eu> X-Enigmail-Version: 1.5a1pre Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2GWMXOHKMAEKERRJRPQUQ" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Dec 2012 19:53:57 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2GWMXOHKMAEKERRJRPQUQ Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 09.12.12 20:01, Mateusz Guzik wrote: > On Sun, Dec 09, 2012 at 07:42:02PM +0100, Florian Smeets wrote: >> On 09.12.12 19:27, Mateusz Guzik wrote: >>> On Sun, Dec 09, 2012 at 07:06:22PM +0100, Florian Smeets wrote: >>>> On 16.11.12 13:05, Andre Oppermann wrote: >>>>> Author: andre >>>>> Date: Fri Nov 16 12:05:10 2012 >>>>> New Revision: 243147 >>>>> URL: http://svnweb.freebsd.org/changeset/base/243147 >>>>> >>>>> Log: >>>>> Change fetch(1) to: >>>>> =20 >>>>> o Report the instantaneous bandwidth instead of an average since = the >>>>> beginning of the download. >>>>> =20 >>>>> o At the finish of the download report the average bandwidth and = also >>>>> the total time it took instead of 00m00s. >>>>> =20 >>>> >>>> Andre, >>>> >>>> it looks like this change breaks the bandwidth calculation when usin= g -r >>>> >>>> 52% of 146 MB -25199509 Bps 03m28s >>>> >>>> Going back to r243146 fixes it. >>>> >>> >>> Try this: >>> diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c >>> index 025fcdc..e723d40 100644 >>> --- a/usr.bin/fetch/fetch.c >>> +++ b/usr.bin/fetch/fetch.c >>> @@ -243,7 +243,7 @@ stat_start(struct xferstat *xs, const char *name,= off_t size, off_t of >>> gettimeofday(&xs->start, NULL); >>> xs->last.tv_sec =3D xs->last.tv_usec =3D 0; >>> xs->size =3D size; >>> - xs->offset =3D offset; >>> + xs->offset =3D 0; >>> xs->rcvd =3D offset; >>> xs->lastrcvd =3D offset; >>> if (v_tty && v_level > 0) >>> >> >> That way the bandwidth calculation looks OK but now it counts the time= >> since starting to resume the download and not the time left :) >> >> 63% of 146 MB 7069 kBps 00m07s >> >=20 > Oops.. revert that and try this instead: > diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c > index 025fcdc..d3e9b21 100644 > --- a/usr.bin/fetch/fetch.c > +++ b/usr.bin/fetch/fetch.c > @@ -183,7 +183,7 @@ stat_bps(struct xferstat *xs) > if (delta =3D=3D 0.0) { > snprintf(str, sizeof str, "?? Bps"); > } else { > - bps =3D (xs->rcvd - xs->lastrcvd - xs->offset) / delta;= > + bps =3D (xs->rcvd - xs->lastrcvd) / delta; > snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps= )); > } > return (str); >=20 That looks much better. 68% of 146 MB 556 kBps 01m40s Thanks! Florian ------enig2GWMXOHKMAEKERRJRPQUQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAlDE7E4ACgkQapo8P8lCvwkdNACffeHvkd0JO8cU8ftkXviDwxeL KzgAoIf2r2Af6pbeyeCA45YCGNZJVuqT =w/Eq -----END PGP SIGNATURE----- ------enig2GWMXOHKMAEKERRJRPQUQ--