From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] fsck: print progress
Date: Thu, 3 Nov 2011 15:51:47 -0400 [thread overview]
Message-ID: <20111103195147.GA21318@sigill.intra.peff.net> (raw)
In-Reply-To: <7vd3d9f0u8.fsf@alter.siamese.dyndns.org>
On Thu, Nov 03, 2011 at 12:43:59PM -0700, Junio C Hamano wrote:
> > But I almost wonder if it is worth factoring out the concept of a
> > "progress group", where you would call it like:
> >
> > progress = progress_group_start("Checking objects in pack", nr_packs);
> > for (p = packed_git; p; p = p->next) {
> > progress_group_next(progress, p->num_objects);
> > for (j = 0; j < num; j++) {
> > fsck_sha1(p, j);
> > display_progress(progress, j+1);
> > }
> > }
> > stop_progress(&progress);
>
> Hmm, once you do this kind of thing I would expect two (or more) progress
> bars to be shown, something like:
>
> $ git fsck --progress
> checking packs: 3 of 7 (42% done)
> checking objects in pack: 12405 of 332340 (4% done)
I don't think we can do multiple lines portably, though, because the
progress code just uses "\r" to return to the beginning of the line.
However, I do think it's a nice design even if the output is the same
right now, because the calling code is specifying more clearly to the
progress code what it actually means. Which means it is easier to
tweak the progress code later to make a prettier representation of that
meaning.
One downside (as with all abstractions :) ), is that it's hard to
deviate from the defaults. With the above, how would you specify if it
was a group of throughput measurements, not counts? Or that you wanted
to use start_progress_delay instead of start_progress on each one?
Or hey, if you really want to get crazy, why can't we check each pack in
parallel on a different CPU, and have all of the progress meters
displayed and moving simultaneously? :)
The last one is obviously a bit tongue in cheek. But it does raise an
interesting point: is seeing the per-pack meter actually useful (whether
parallel or not)? The user just wants to know that progress is being
made, and when it is done. And maybe that argues for just summing the
size of each pack and showing a single progress meter per task.
-Peff
next prev parent reply other threads:[~2011-11-03 19:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-02 12:06 long fsck time Nguyen Thai Ngoc Duy
2011-11-02 12:10 ` Nguyen Thai Ngoc Duy
2011-11-02 21:33 ` Jeff King
2011-11-03 1:36 ` Nguyen Thai Ngoc Duy
2011-11-03 3:21 ` [PATCH] fsck: print progress Nguyễn Thái Ngọc Duy
2011-11-03 3:33 ` Jeff King
2011-11-03 8:50 ` Nguyễn Thái Ngọc Duy
2011-11-03 19:38 ` Jeff King
2011-11-03 19:43 ` Junio C Hamano
2011-11-03 19:51 ` Jeff King [this message]
2011-11-03 20:28 ` Junio C Hamano
2011-11-03 20:29 ` Jeff King
2011-11-03 20:56 ` Junio C Hamano
2011-11-03 21:18 ` Jeff King
2011-11-04 3:10 ` Nguyễn Thái Ngọc Duy
2011-11-05 7:53 ` Stephen Boyd
2011-11-05 9:02 ` Nguyen Thai Ngoc Duy
2011-11-05 19:15 ` Stephen Boyd
2011-11-05 23:59 ` Junio C Hamano
2011-11-06 2:37 ` Nguyen Thai Ngoc Duy
2011-11-06 6:05 ` Junio C Hamano
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=20111103195147.GA21318@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).