[PATCH 2/2] pack-objects: report actual number of threads to be used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the case of a small repository, pack-objects is smart enough to not start
more threads than necessary. However, the output to the user always reports
the value of the pack.threads configuration and not the real number of
threads to be used. This is easily fixed by moving the printing of the
message after we have partitioned our work.

(pack.threads is on autodetect and would be set to 4)
$ git-repack -a -d -f
Counting objects: 55, done.
Delta compression using 2 threads.
Compressing objects: 100% (48/48), done.
Writing objects: 100% (55/55), done.
Total 55 (delta 10), reused 0 (delta 0)

Signed-off-by: Dan McGee <dpmcgee@xxxxxxxxx>
---
 builtin-pack-objects.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 9fc3b35..8c1b036 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1611,9 +1611,6 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
 		find_deltas(list, &list_size, window, depth, processed);
 		return;
 	}
-	if (progress > pack_to_stdout)
-		fprintf(stderr, "Delta compression using %d threads.\n",
-				delta_search_threads);
 
 	/* Partition the work amongst work threads. */
 	for (i = 0; i < delta_search_threads; i++) {
@@ -1638,11 +1635,18 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
 		p[i].list = list;
 		p[i].list_size = sub_size;
 		p[i].remaining = sub_size;
+		if(sub_size)
+			active_threads++;
 
 		list += sub_size;
 		list_size -= sub_size;
 	}
 
+	if (progress > pack_to_stdout)
+		fprintf(stderr, "Delta compression using %d threads.\n",
+				active_threads);
+	active_threads = 0;
+
 	/* Start work threads. */
 	for (i = 0; i < delta_search_threads; i++) {
 		if (!p[i].list_size)
-- 
1.6.2.2.404.ge96f3.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux