From be384e845129b677e70d877fe914f2cab0900abf Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 21 Mar 2010 14:35:03 +0000 Subject: Make multigcc.pl actually use more than one core on OS X and opensolaris. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25274 a1c6a512-1295-4272-9138-f99709370657 --- tools/multigcc.pl | 24 ++++++++++++++++++++---- 1 file 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 @@ #!/usr/bin/perl +use Switch; use List::Util 'shuffle'; # standard from Perl 5.8 and later my $tempfile = "multigcc.out"; @@ -24,10 +25,25 @@ my $command = join " ", @params; @files = shuffle(@files); # count number of cores -my $cores = 1; -if (open CPUINFO, "; - close CPUINFO; +my $cores; +switch($^O) { + case "darwin" { + chomp($cores = `sysctl -n hw.ncpu`); + $cores = 1 if ($?); + } + case "solaris" { + $cores = scalar grep /on-line/i, `psrinfo`; + $cores = 1 if ($?); + } + else { + if (open CPUINFO, "; + close CPUINFO; + } + else { + $cores = 1; + } + } } # don't run empty children -- cgit v1.2.3