summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/multigcc.pl24
1 files changed, 20 insertions, 4 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl
index fbe7c17aae..5222f61b49 100755
--- a/tools/multigcc.pl
+++ b/tools/multigcc.pl
@@ -1,4 +1,5 @@
1#!/usr/bin/perl 1#!/usr/bin/perl
2use Switch;
2use List::Util 'shuffle'; # standard from Perl 5.8 and later 3use List::Util 'shuffle'; # standard from Perl 5.8 and later
3 4
4my $tempfile = "multigcc.out"; 5my $tempfile = "multigcc.out";
@@ -24,10 +25,25 @@ my $command = join " ", @params;
24@files = shuffle(@files); 25@files = shuffle(@files);
25 26
26# count number of cores 27# count number of cores
27my $cores = 1; 28my $cores;
28if (open CPUINFO, "</proc/cpuinfo") { 29switch($^O) {
29 $cores = scalar grep /^processor/i, <CPUINFO>; 30 case "darwin" {
30 close CPUINFO; 31 chomp($cores = `sysctl -n hw.ncpu`);
32 $cores = 1 if ($?);
33 }
34 case "solaris" {
35 $cores = scalar grep /on-line/i, `psrinfo`;
36 $cores = 1 if ($?);
37 }
38 else {
39 if (open CPUINFO, "</proc/cpuinfo") {
40 $cores = scalar grep /^processor/i, <CPUINFO>;
41 close CPUINFO;
42 }
43 else {
44 $cores = 1;
45 }
46 }
31} 47}
32 48
33# don't run empty children 49# don't run empty children