public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: James Cloos <cloos@jhcloos•com>
To: Nicolas Pitre <nico@cam•org>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 1/1] Improve progress display in kB range.
Date: Tue, 21 Apr 2009 16:16:53 -0400	[thread overview]
Message-ID: <m3d4b5oj76.fsf@lugabout.jhcloos.org> (raw)
In-Reply-To: <alpine.LFD.2.00.0904211319570.6741@xanadu.home> (Nicolas Pitre's message of "Tue, 21 Apr 2009 13:28:04 -0400 (EDT)")

>>>>> "Nicolas" == Nicolas Pitre <nico@cam•org> writes:

Nicolas> Empirical evidence on my side shows the opposite.  I just did a fetch in 
Nicolas> my kernel repo and got:

Nicolas>    Receiving objects: 100% (1373/1373), 223.36 KiB, done.

OK.  That does show that my proposed patch is incomplete.

The contrary example is from the final output, if the received pack
is less than a Meg.  The annoyance is in the progress display.

In index-pack.c, fill() calls xread() and then display_throughput().
Since xread() is designed to call read(2) and simple continue on any
EINTR or EAGAIN, then — even though xread() explicitly does not
guarantee that ‘len’ bytes are read even if the data are available —
in practice xread() fills its buffer.  (At least on 32-bit x86,
using Linus’ kernel.)

Therefore, in practice — and as I have witnessed several thousand times
without ever having seen a contrary example — display_throughput() is
called *durring* a download only when total & 0xFFF == 0xFFF.

Perhaps, then, display_throughput() should round differently, so that
the logical equivilent of:

         ( ( n << 10) & 0x3FF ) / 1024.0

would be rounded up.  Then throughput_string() could elide the ".%2.2u"
whenever ((int)(total & ((1 << 10) - 1)) * 100) >> 10) == 0.

Or throughput_string() could simply elide the ".%2.2u" whenever
total & 0x3FF == 0x3FF.

Nicolas> I must NACK your patches.  Presumptions are not good enough
Nicolas> justification for such a change, especially if results can't
Nicolas> be reproduced.

Understood.  I concentrated on the progress display and ignored the
final display.

-JimC
-- 
James Cloos <cloos@jhcloos•com>         OpenPGP: 1024D/ED7DAEA6

  reply	other threads:[~2009-04-21 20:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-19  4:38 [PATCH 0/1] Improve progress display in kB range James Cloos
2009-04-19  4:32 ` [PATCH 1/1] " James Cloos
2009-04-21  4:56   ` Nicolas Pitre
2009-04-21 17:11     ` James Cloos
2009-04-21 17:28       ` Nicolas Pitre
2009-04-21 20:16         ` James Cloos [this message]
2009-04-22 14:33           ` James Cloos
2009-04-22 19:44             ` Junio C Hamano
2009-04-22 22:35               ` James Cloos
2009-04-23  6:23                 ` Johannes Sixt
2009-04-24 20:15                 ` James Cloos
2009-04-24 21:46                   ` Nicolas Pitre
2009-04-24 22:20                     ` James Cloos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3d4b5oj76.fsf@lugabout.jhcloos.org \
    --to=cloos@jhcloos$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=nico@cam$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox