summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 59921b4)
raw | patch | inline | side by side (parent: 59921b4)
author | Nicolas Pitre <nico@cam.org> | |
Mon, 10 Sep 2007 04:06:11 +0000 (00:06 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Sep 2007 05:26:06 +0000 (22:26 -0700) |
This adds a --threads=<n> parameter to 'git pack-objects' with
documentation.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
documentation.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-pack-objects.txt | patch | blob | history | |
builtin-pack-objects.c | patch | blob | history |
index 6f17cff24ab784ee68767724dff6892b67b3ad53..f9b97956e36363504192056953d137c0f517f27d 100644 (file)
length, this option typically shrinks the resulting
packfile by 3-5 per-cent.
+--threads=<n>::
+ Specifies the number of threads to spawn when searching for best
+ delta matches. This requires that pack-objects be compiled with
+ pthreads otherwise this option is ignored with a warning.
+ This is meant to reduce packing time on multiprocessor machines.
+ The required amount of memory for the delta search window is
+ however multiplied by the number of threads.
+
--index-version=<version>[,<offset>]::
This is intended to be used by the test suite only. It allows
to force the version for the generated pack index, and to force
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index b13558ee7ea2623d426bc4af7787e3e488990dda..42698d29486390f4aef727ef5771d87a95dbbfcc 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
[--max-pack-size=N] [--local] [--incremental] \n\
[--window=N] [--window-memory=N] [--depth=N] \n\
[--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] \n\
- [--non-empty] [--revs [--unpacked | --all]*] [--reflog] \n\
+ [--threads=N] [--non-empty] [--revs [--unpacked | --all]*] [--reflog] \n\
[--stdout | base-name] [<ref-list | <object-list]";
struct object_entry {
static int window = 10;
static uint32_t pack_size_limit;
static int depth = 50;
+static int delta_search_threads = 1;
static int pack_to_stdout;
static int num_preferred_base;
static struct progress progress_state;
}
}
-#define NR_THREADS 4
-
static void ll_find_deltas(struct object_entry **list, unsigned list_size,
int window, int depth, unsigned *processed)
{
- struct thread_params p[NR_THREADS];
+ struct thread_params p[delta_search_threads];
int i, ret;
unsigned chunk_size;
+ if (delta_search_threads <= 1) {
+ find_deltas(list, list_size, window, depth, processed);
+ return;
+ }
+
pthread_mutex_lock(&data_provider);
pthread_mutex_lock(&data_ready);
- for (i = 0; i < NR_THREADS; i++) {
+ for (i = 0; i < delta_search_threads; i++) {
p[i].window = window;
p[i].depth = depth;
p[i].processed = processed;
usage(pack_usage);
continue;
}
+ if (!prefixcmp(arg, "--threads=")) {
+ char *end;
+ delta_search_threads = strtoul(arg+10, &end, 0);
+ if (!arg[10] || *end || delta_search_threads < 1)
+ usage(pack_usage);
+#ifndef THREADED_DELTA_SEARCH
+ if (delta_search_threads > 1)
+ warning("no threads support, "
+ "ignoring %s", arg);
+#endif
+ continue;
+ }
if (!prefixcmp(arg, "--depth=")) {
char *end;
depth = strtoul(arg+8, &end, 0);