From owner-svn-src-all@FreeBSD.ORG Sun Dec 9 23:01:59 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 A09ECC77 for ; Sun, 9 Dec 2012 23:01:59 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 088688FC13 for ; Sun, 9 Dec 2012 23:01:58 +0000 (UTC) Received: (qmail 97346 invoked from network); 10 Dec 2012 00:31:22 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 10 Dec 2012 00:31:22 -0000 Message-ID: <50C5185D.3080802@freebsd.org> Date: Mon, 10 Dec 2012 00:01:49 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 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> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Florian Smeets , src-committers@freebsd.org 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 23:01:59 -0000 On 09.12.2012 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: >>>>> >>>>> o Report the instantaneous bandwidth instead of an average since the >>>>> beginning of the download. >>>>> >>>>> o At the finish of the download report the average bandwidth and also >>>>> the total time it took instead of 00m00s. >>>>> >>>> >>>> Andre, >>>> >>>> it looks like this change breaks the bandwidth calculation when using -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 = xs->last.tv_usec = 0; >>> xs->size = size; >>> - xs->offset = offset; >>> + xs->offset = 0; >>> xs->rcvd = offset; >>> xs->lastrcvd = 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 >> > > 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 == 0.0) { > snprintf(str, sizeof str, "?? Bps"); > } else { > - bps = (xs->rcvd - xs->lastrcvd - xs->offset) / delta; > + bps = (xs->rcvd - xs->lastrcvd) / delta; > snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps)); > } > return (str); Thank you for this patch. Committed as r244058. -- Andre