author | Andreas Ericsson <ae@op5.se> | |
Sat, 23 Feb 2008 02:11:56 +0000 (20:11 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 23 Feb 2008 20:00:32 +0000 (12:00 -0800) | ||
commit | 833e3df17188e48b2d31db0966a4051dad5e03b9 | |
tree | 265fb9405efb644ff564ac1b77991d62795006a2 | tree | snapshot |
parent | 923d44aeb7cb6d21eeb459fdc1b58137e37c2b1c | commit | diff |
pack-objects: Add runtime detection of online CPU's
Packing objects can be done in parallell nowadays, but it's
only done if the config option pack.threads is set to a value
above 1. Because of that, the code-path used is often not the
most optimal one.
This patch adds a routine to detect the number of online CPU's
at runtime (online_cpus()). When pack.threads (or --threads=) is
given a value of 0, the number of threads is set to the number of
online CPU's. This feature is also documented.
As per Nicolas Pitre's recommendations, the default is still to
run pack-objects single-threaded unless explicitly activated,
either by configuration or by command line parameter.
The routine online_cpus() is a rework of "numcpus.c", written by
one Philip Willoughby <pgw99@doc.ic.ac.uk>. numcpus.c is in the
public domain and can presently be downloaded from
http://csgsoft.doc.ic.ac.uk/numcpus/
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Packing objects can be done in parallell nowadays, but it's
only done if the config option pack.threads is set to a value
above 1. Because of that, the code-path used is often not the
most optimal one.
This patch adds a routine to detect the number of online CPU's
at runtime (online_cpus()). When pack.threads (or --threads=) is
given a value of 0, the number of threads is set to the number of
online CPU's. This feature is also documented.
As per Nicolas Pitre's recommendations, the default is still to
run pack-objects single-threaded unless explicitly activated,
either by configuration or by command line parameter.
The routine online_cpus() is a rework of "numcpus.c", written by
one Philip Willoughby <pgw99@doc.ic.ac.uk>. numcpus.c is in the
public domain and can presently be downloaded from
http://csgsoft.doc.ic.ac.uk/numcpus/
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt | diff | blob | history | |
Documentation/git-pack-objects.txt | diff | blob | history | |
Makefile | diff | blob | history | |
builtin-pack-objects.c | diff | blob | history | |
thread-utils.c | [new file with mode: 0644] | blob |
thread-utils.h | [new file with mode: 0644] | blob |