[MERGE] FreeBSD concurrency detection
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Jun 5 12:13:18 BST 2009
The following may be approve if the remarks below are not worth
it.
BB:tweak
>>>>> "fullermd" == Matthew D Fuller <fullermd at over-yonder.net> writes:
fullermd> Building on just-landed changes, this seems to DTRT in some quick
fullermd> testing.
The main source of mis-interpretation seems to be between number
of cpus and number of cores (see windows case).
What we care is most of the time the number of cores since we
want to maximize CPU usage by spawning one thread by available
core. Some early experiment showed dramatic degradation when
using more processes than cores.
So the question is: Matthew, what is your hardware, is the above
taken into account ?
<snip/>
fullermd> === modified file 'bzrlib/osutils.py'
fullermd> --- bzrlib/osutils.py 2009-06-05 07:10:13 +0000
fullermd> +++ bzrlib/osutils.py 2009-06-05 09:13:02 +0000
fullermd> @@ -1841,6 +1841,10 @@
fullermd> def _local_concurrency():
fullermd> return subprocess.Popen(['sysctl', '-n', 'hw.availcpu'],
fullermd> stdout=subprocess.PIPE).communicate()[0]
fullermd> +elif sys.platform[0:7] == 'freebsd':
fullermd> + def _local_concurrency():
fullermd> + return subprocess.Popen(['sysctl', '-n', 'hw.ncpu'],
fullermd> + stdout=subprocess.PIPE).communicate()[0]
You should know better than me here if
sys.platform.startswith('freebsd') is a valid alternative.
I wondered about that myself when using linux2... but couldn't
find any indication in python sources about 'linux', 'linux1' or
'linux3'...
Also, could that be applied to openbsd ? Netbsd ? mymombsd ?
Vincent
P.S.: Depending on selftest state of affair on freebsd, you may
experiment *different* failures, so feedback higly welcome of any
strange failures you may encounter while using --parallel=fork.
More information about the bazaar
mailing list