<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/progress.c, branch v2.15.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.15.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.15.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-08-19T21:01:34Z</updated>
<entry>
<title>progress: simplify "delayed" progress API</title>
<updated>2017-08-19T21:01:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-19T17:39:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8aade107dd84dcaff3f23caae80a013878db2de7'/>
<id>urn:sha1:8aade107dd84dcaff3f23caae80a013878db2de7</id>
<content type='text'>
We used to expose the full power of the delayed progress API to the
callers, so that they can specify, not just the message to show and
expected total amount of work that is used to compute the percentage
of work performed so far, the percent-threshold parameter P and the
delay-seconds parameter N.  The progress meter starts to show at N
seconds into the operation only if we have not yet completed P per-cent
of the total work.

Most callers used either (0%, 2s) or (50%, 1s) as (P, N), but there
are oddballs that chose more random-looking values like 95%.

For a smoother workload, (50%, 1s) would allow us to start showing
the progress meter earlier than (0%, 2s), while keeping the chance
of not showing progress meter for long running operation the same as
the latter.  For a task that would take 2s or more to complete, it
is likely that less than half of it would complete within the first
second, if the workload is smooth.  But for a spiky workload whose
earlier part is easier, such a setting is likely to fail to show the
progress meter entirely and (0%, 2s) is more appropriate.

But that is merely a theory.  Realistically, it is of dubious value
to ask each codepath to carefully consider smoothness of their
workload and specify their own setting by passing two extra
parameters.  Let's simplify the API by dropping both parameters and
have everybody use (0%, 2s).

Oh, by the way, the percent-threshold parameter and the structure
member were consistently misspelled, which also is now fixed ;-)

Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: show overall rate in last update</title>
<updated>2017-07-09T16:54:20Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-07-08T16:43:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0fae1e072a925b76f35666c9bcd965ea5e3e5574'/>
<id>urn:sha1:0fae1e072a925b76f35666c9bcd965ea5e3e5574</id>
<content type='text'>
The values in struct throughput are only updated every 0.5 seconds.  If
we're all done before that time span then the final update will show a
rate of 0 bytes/s, which is misleading if some bytes had been handled.
Remember the start time and show the total throughput instead.

And avoid division by zero by enforcing a minimum time span value of 1
(unit: 1/1024th of a second).  That makes the resulting rate an
underestimation, but it's closer to the actual value than the currently
shown 0 bytes/s.

Reported-by: 積丹尼 Dan Jacobson &lt;jidanni@jidanni.org&gt;
Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stop_progress_msg: convert xsnprintf to xstrfmt</title>
<updated>2017-02-16T19:28:02Z</updated>
<author>
<name>Maxim Moseychuk</name>
<email>franchesko.salias.hudro.pedros@gmail.com</email>
</author>
<published>2017-02-16T17:07:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fbd09439c097123346d9823b88c87438bf5a11ae'/>
<id>urn:sha1:fbd09439c097123346d9823b88c87438bf5a11ae</id>
<content type='text'>
Simplify code by replacing buffer allocation with a call to xstrfmt().

Signed-off-by: Maxim Moseychuk &lt;franchesko.salias.hudro.pedros@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use xmallocz to avoid size arithmetic</title>
<updated>2016-02-22T22:51:09Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:44:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3733e6946465d4a3a1d89026a5ec911d3af339ab'/>
<id>urn:sha1:3733e6946465d4a3a1d89026a5ec911d3af339ab</id>
<content type='text'>
We frequently allocate strings as xmalloc(len + 1), where
the extra 1 is for the NUL terminator. This can be done more
simply with xmallocz, which also checks for integer
overflow.

There's no case where switching xmalloc(n+1) to xmallocz(n)
is wrong; the result is the same length, and malloc made no
guarantees about what was in the buffer anyway. But in some
cases, we can stop manually placing NUL at the end of the
allocated buffer. But that's only safe if it's clear that
the contents will always fill the buffer.

In each case where this patch does so, I manually examined
the control flow, and I tried to err on the side of caution.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stop_progress_msg: convert sprintf to xsnprintf</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:06:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f5691aa640ae2c1c5f85037e093de7f310c0eac7'/>
<id>urn:sha1:f5691aa640ae2c1c5f85037e093de7f310c0eac7</id>
<content type='text'>
The usual arguments for using xsnprintf over sprintf apply,
but this case is a little tricky. We print to a fixed-size
buffer if we have room, and otherwise to an allocated
buffer. So there should be no overflow here, but it is still
good to communicate our intention, as well as to check our
earlier math for how much space the string will need.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: store throughput display in a strbuf</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:05:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3131977de1476185209d4d56a0494f5b30ee5557'/>
<id>urn:sha1:3131977de1476185209d4d56a0494f5b30ee5557</id>
<content type='text'>
Coverity noticed that we strncpy() into a fixed-size buffer
without making sure that it actually ended up
NUL-terminated. This is unlikely to be a bug in practice,
since throughput strings rarely hit 32 characters, but it
would be nice to clean it up.

The most obvious way to do so is to add a NUL-terminator.
But instead, this patch switches the fixed-size buffer out
for a strbuf. At first glance this seems much less
efficient, until we realize that filling in the fixed-size
buffer is done by writing into a strbuf and copying the
result!

By writing straight to the buffer, we actually end up more
efficient:

  1. We avoid an extra copy of the bytes.

  2. Rather than malloc/free each time progress is shown, we
     can strbuf_reset and use the same buffer each time.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: treat "no terminal" as being in the foreground</title>
<updated>2015-05-19T16:35:14Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-05-19T05:24:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a4fb76ce1916939c7e6359f9416f2af4a760f6f1'/>
<id>urn:sha1:a4fb76ce1916939c7e6359f9416f2af4a760f6f1</id>
<content type='text'>
progress: treat "no terminal" as being in the foreground

Commit 85cb890 (progress: no progress in background,
2015-04-13) avoids sending progress from background
processes by checking that the process group id of the
current process is the same as that of the controlling
terminal.

If we don't have a terminal, however, this check never
succeeds, and we print no progress at all (until the final
"done" message). This can be seen when cloning a large
repository; instead of getting progress updates for
"counting objects", it will appear to hang then print the
final count.

We can fix this by treating an error return from tcgetpgrp()
as a signal to show the progress.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: no progress in background</title>
<updated>2015-04-15T18:50:24Z</updated>
<author>
<name>Luke Mewburn</name>
<email>luke@mewburn.net</email>
</author>
<published>2015-04-13T13:30:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=85cb8906f0e9b5639230fe247d5d916db8806777'/>
<id>urn:sha1:85cb8906f0e9b5639230fe247d5d916db8806777</id>
<content type='text'>
Disable the display of the progress if stderr is not the
current foreground process.
Still display the final result when done.

Signed-off-by: Luke Mewburn &lt;luke@mewburn.net&gt;
Acked-by: Nicolas Pitre &lt;nico@fluxnic.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: simplify performance measurement by using getnanotime()</title>
<updated>2014-07-14T04:25:21Z</updated>
<author>
<name>Karsten Blees</name>
<email>karsten.blees@gmail.com</email>
</author>
<published>2014-07-12T00:08:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=83d26fa724ef2efbeb332fa3dc92b00c0e579f28'/>
<id>urn:sha1:83d26fa724ef2efbeb332fa3dc92b00c0e579f28</id>
<content type='text'>
Calculating duration from a single uint64_t is simpler than from a struct
timeval. Change throughput measurement from gettimeofday() to
getnanotime().

Also calculate misec only if needed, and change integer division to integer
multiplication + shift, which should be slightly faster.

Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>i18n: mark all progress lines for translation</title>
<updated>2014-02-24T17:08:37Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-02-21T12:50:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=754dbc43f078625f38c7908f19dc71a0c617ec85'/>
<id>urn:sha1:754dbc43f078625f38c7908f19dc71a0c617ec85</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
