From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>, git@vger.kernel.org
Subject: Re: non-smooth progress indication for git fsck and git gc
Date: Thu, 16 Aug 2018 15:10:02 -0700 [thread overview]
Message-ID: <xmqq36vedkud.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180816200222.GA7422@sigill.intra.peff.net> (Jeff King's message of "Thu, 16 Aug 2018 16:02:23 -0400")
Jeff King <peff@peff.net> writes:
> On Thu, Aug 16, 2018 at 11:57:14AM -0400, Jeff King wrote:
>
>> The only way to solve that is to count bytes. We don't have a total byte
>> count in most cases, and it wouldn't always make sense (e.g., the
>> "Compressing objects" meter can show the same issue, but it's not really
>> putting through bytes in a linear way). In some cases we do show
>> transmitted size and throughput, but that's just for network operations.
>> We could do the same for "gc" with the patch below. But usually
>> throughput isn't all that interesting for a filesystem write, because
>> bandwidth isn't the bottleneck.
>
> Just realized I forgot to include the patch. Here it is, for reference.
I've been wondering when you'd realize the omission ;-)
> Doing something similar for fsck would be quite a bit more invasive.
Yeah, on that codepath there is no streaming write passing through a
single chokepoint you can count bytes X-<.
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 80c880e9ad..e1130b959d 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -837,7 +837,7 @@ static void write_pack_file(void)
> if (pack_to_stdout)
> f = hashfd_throughput(1, "<stdout>", progress_state);
> else
> - f = create_tmp_packfile(&pack_tmp_name);
> + f = create_tmp_packfile(&pack_tmp_name, progress_state);
>
> offset = write_pack_header(f, nr_remaining);
>
> diff --git a/bulk-checkin.c b/bulk-checkin.c
> index 9f3b644811..0df45b8f55 100644
> --- a/bulk-checkin.c
> +++ b/bulk-checkin.c
> @@ -178,7 +178,7 @@ static void prepare_to_stream(struct bulk_checkin_state *state,
> if (!(flags & HASH_WRITE_OBJECT) || state->f)
> return;
>
> - state->f = create_tmp_packfile(&state->pack_tmp_name);
> + state->f = create_tmp_packfile(&state->pack_tmp_name, NULL);
> reset_pack_idx_option(&state->pack_idx_opts);
>
> /* Pretend we are going to write only one object */
> diff --git a/pack-write.c b/pack-write.c
> index a9d46bc03f..b72480b440 100644
> --- a/pack-write.c
> +++ b/pack-write.c
> @@ -334,14 +334,15 @@ int encode_in_pack_object_header(unsigned char *hdr, int hdr_len,
> return n;
> }
>
> -struct hashfile *create_tmp_packfile(char **pack_tmp_name)
> +struct hashfile *create_tmp_packfile(char **pack_tmp_name,
> + struct progress *progress)
> {
> struct strbuf tmpname = STRBUF_INIT;
> int fd;
>
> fd = odb_mkstemp(&tmpname, "pack/tmp_pack_XXXXXX");
> *pack_tmp_name = strbuf_detach(&tmpname, NULL);
> - return hashfd(fd, *pack_tmp_name);
> + return hashfd_throughput(fd, *pack_tmp_name, progress);
> }
>
> void finish_tmp_packfile(struct strbuf *name_buffer,
> diff --git a/pack.h b/pack.h
> index 34a9d458b4..c87628b093 100644
> --- a/pack.h
> +++ b/pack.h
> @@ -98,7 +98,8 @@ extern int encode_in_pack_object_header(unsigned char *hdr, int hdr_len,
> #define PH_ERROR_PROTOCOL (-3)
> extern int read_pack_header(int fd, struct pack_header *);
>
> -extern struct hashfile *create_tmp_packfile(char **pack_tmp_name);
> +extern struct hashfile *create_tmp_packfile(char **pack_tmp_name,
> + struct progress *progress);
> extern void finish_tmp_packfile(struct strbuf *name_buffer, const char *pack_tmp_name, struct pack_idx_entry **written_list, uint32_t nr_written, struct pack_idx_option *pack_idx_opts, unsigned char sha1[]);
>
> #endif
next prev parent reply other threads:[~2018-08-16 22:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-16 6:54 non-smooth progress indication for git fsck and git gc Ulrich Windl
2018-08-16 15:18 ` Duy Nguyen
2018-08-16 16:05 ` Jeff King
2018-08-20 8:27 ` Antw: " Ulrich Windl
2018-08-16 15:57 ` Jeff King
2018-08-16 20:02 ` Jeff King
2018-08-16 22:10 ` Junio C Hamano [this message]
2018-08-16 20:35 ` Ævar Arnfjörð Bjarmason
2018-08-16 20:55 ` Jeff King
2018-08-16 21:06 ` Jeff King
2018-08-17 14:39 ` Duy Nguyen
2018-08-20 8:33 ` Antw: " Ulrich Windl
2018-08-20 8:57 ` Ævar Arnfjörð Bjarmason
2018-08-20 9:37 ` Ulrich Windl
2018-08-21 1:07 ` Jeff King
2018-08-21 6:20 ` Ulrich Windl
2018-08-21 15:21 ` Duy Nguyen
2018-09-01 12:53 ` Ævar Arnfjörð Bjarmason
2018-09-01 13:52 ` Ævar Arnfjörð Bjarmason
2018-09-02 7:46 ` Jeff King
2018-09-02 7:55 ` Jeff King
2018-09-02 8:55 ` Jeff King
2018-09-03 16:48 ` Ævar Arnfjörð Bjarmason
2018-09-07 3:30 ` Jeff King
2018-09-04 15:53 ` 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=xmqq36vedkud.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=Ulrich.Windl@rz.uni-regensburg.de \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).