From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] rearrange delta search progress reporting
Date: Thu, 06 Sep 2007 02:13:10 -0400 [thread overview]
Message-ID: <11890591923270-git-send-email-nico@cam.org> (raw)
In-Reply-To: <11890591923123-git-send-email-nico@cam.org>
This is to help threadification of the delta search code, with a bonus
consistency check.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
builtin-pack-objects.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index b8495bf..9d56592 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1438,17 +1438,15 @@ static unsigned long free_unpacked(struct unpacked *n)
}
static void find_deltas(struct object_entry **list, unsigned list_size,
- unsigned nr_deltas, int window, int depth)
+ int window, int depth, unsigned *processed)
{
- uint32_t i = list_size, idx = 0, count = 0, processed = 0;
+ uint32_t i = list_size, idx = 0, count = 0;
unsigned int array_size = window * sizeof(struct unpacked);
struct unpacked *array;
unsigned long mem_usage = 0;
array = xmalloc(array_size);
memset(array, 0, array_size);
- if (progress)
- start_progress(&progress_state, "Deltifying %u objects...", "", nr_deltas);
do {
struct object_entry *entry = list[--i];
@@ -1472,8 +1470,9 @@ static void find_deltas(struct object_entry **list, unsigned list_size,
if (entry->preferred_base)
goto next;
+ (*processed)++;
if (progress)
- display_progress(&progress_state, ++processed);
+ display_progress(&progress_state, *processed);
/*
* If the current object is at pack edge, take the depth the
@@ -1536,9 +1535,6 @@ static void find_deltas(struct object_entry **list, unsigned list_size,
idx = 0;
} while (i > 0);
- if (progress)
- stop_progress(&progress_state);
-
for (i = 0; i < window; ++i) {
free_delta_index(array[i].index);
free(array[i].data);
@@ -1581,8 +1577,17 @@ static void prepare_pack(int window, int depth)
}
if (nr_deltas) {
+ unsigned nr_done = 0;
+ if (progress)
+ start_progress(&progress_state,
+ "Deltifying %u objects...", "",
+ nr_deltas);
qsort(delta_list, n, sizeof(*delta_list), type_size_sort);
- find_deltas(delta_list, n, nr_deltas, window+1, depth);
+ find_deltas(delta_list, n, window+1, depth, &nr_done);
+ if (progress)
+ stop_progress(&progress_state);
+ if (nr_done != nr_deltas)
+ die("inconsistency with delta count");
}
free(delta_list);
}
--
1.5.3.1.844.g0a05-dirty
next prev parent reply other threads:[~2007-09-06 6:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-06 6:13 [PATCH] straighten the list of objects to deltify Nicolas Pitre
2007-09-06 6:13 ` [PATCH] localize window memory usage accounting Nicolas Pitre
2007-09-06 6:13 ` Nicolas Pitre [this message]
2007-09-06 6:13 ` [PATCH] basic threaded delta search Nicolas Pitre
2007-09-06 6:19 ` David Kastrup
2007-09-06 6:23 ` Nicolas Pitre
2007-09-06 7:01 ` Junio C Hamano
2007-09-06 14:48 ` Nicolas Pitre
2007-09-07 6:11 ` Martin Koegler
2007-09-07 16:19 ` Nicolas Pitre
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11890591923270-git-send-email-nico@cam.org \
--to=nico@cam.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).