git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] Improve progress display in kB range.

From
James Cloos <cloos@jhcloos.com>
Date
Apr 21, 2009, 20:16 UTC
Message-ID
<m3d4b5oj76.fsf@lugabout.jhcloos.org>
In-Reply-To
<alpine.LFD.2.00.0904211319570.6741@xanadu.home>
>>>>> "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
Previous: Nicolas PitreNext: James Cloos
Message 6 of 13 in “Improve progress display in kB range.”
  1. 0/1 Improve progress display in kB range.James Cloos, Apr 19, 2009
  2. 1/1 Improve progress display in kB range.James Cloos, Apr 19, 2009
  3. Nicolas PitreApr 21, 2009
  4. James CloosApr 21, 2009
  5. Nicolas PitreApr 21, 2009
  6. James CloosApr 21, 2009
  7. James CloosApr 22, 2009
  8. Junio C HamanoApr 22, 2009
  9. James CloosApr 22, 2009
  10. Johannes SixtApr 23, 2009
  11. James CloosApr 24, 2009
  12. Nicolas PitreApr 24, 2009
  13. James CloosApr 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.