use cpus+1 for tests

@swtaarrs says repo contention is a thing of the past and this is the right load to put on the cpu.
Esse commit está contido em:
Paul Tarjan
2013-06-12 15:41:42 -07:00
commit de sgolemon
commit b2fb023ca8
+12 -1
Ver Arquivo
@@ -507,6 +507,17 @@ function run_test($options, $test) {
}
}
function num_cpus() {
$data = file('/proc/stat');
$cores = 0;
foreach($data as $line) {
if (preg_match('/^cpu[0-9]/', $line)) {
$cores++;
}
}
return $cores;
}
function main($argv) {
ini_set('pcre.backtrack_limit', PHP_INT_MAX);
@@ -517,7 +528,7 @@ function main($argv) {
}
$tests = find_tests($files);
$threads = min(count($tests), idx($options, 'threads', 20));
$threads = min(count($tests), idx($options, 'threads', num_cpus() + 1));
if (!isset($options['fbmake'])) {
print "Running ".count($tests)." tests in $threads threads\n";