From b2fb023ca8dd7ec3780f4a037dad5f819c76e4ad Mon Sep 17 00:00:00 2001 From: Paul Tarjan Date: Wed, 12 Jun 2013 15:41:42 -0700 Subject: [PATCH] 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. --- hphp/test/run | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hphp/test/run b/hphp/test/run index fc6e34669..fb4d328bc 100755 --- a/hphp/test/run +++ b/hphp/test/run @@ -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";