Skip to content
Permalink
Browse files
Windows, mtr - correctly determine CPU count, for --parallel=auto
  • Loading branch information
vaintroub committed Feb 14, 2018
1 parent c6e3527 commit 46496b1
Showing 1 changed file with 11 additions and 6 deletions.
@@ -431,16 +431,21 @@ sub main {
my $num_tests= @$tests;
if ( $opt_parallel eq "auto" ) {
# Try to find a suitable value for number of workers
my $sys_info= My::SysInfo->new();

$opt_parallel= $sys_info->num_cpus();
for my $limit (2000, 1500, 1000, 500){
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
if (IS_WINDOWS)
{
$opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1;
}
else
{
my $sys_info= My::SysInfo->new();
$opt_parallel= $sys_info->num_cpus();
for my $limit (2000, 1500, 1000, 500){
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
}
}
my $max_par= $ENV{MTR_MAX_PARALLEL} || 8;
$opt_parallel= $max_par if ($opt_parallel > $max_par);
$opt_parallel= $num_tests if ($opt_parallel > $num_tests);
$opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());
$opt_parallel= 1 if ($opt_parallel < 1);
mtr_report("Using parallel: $opt_parallel");
}

0 comments on commit 46496b1

Please sign in to comment.