forked from len0rd/rockbox
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
This commit is contained in:
parent
18e7c1f4af
commit
be384e8451
1 changed files with 20 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
use Switch;
|
||||||
use List::Util 'shuffle'; # standard from Perl 5.8 and later
|
use List::Util 'shuffle'; # standard from Perl 5.8 and later
|
||||||
|
|
||||||
my $tempfile = "multigcc.out";
|
my $tempfile = "multigcc.out";
|
||||||
|
@ -24,11 +25,26 @@ my $command = join " ", @params;
|
||||||
@files = shuffle(@files);
|
@files = shuffle(@files);
|
||||||
|
|
||||||
# count number of cores
|
# count number of cores
|
||||||
my $cores = 1;
|
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, "</proc/cpuinfo") {
|
if (open CPUINFO, "</proc/cpuinfo") {
|
||||||
$cores = scalar grep /^processor/i, <CPUINFO>;
|
$cores = scalar grep /^processor/i, <CPUINFO>;
|
||||||
close CPUINFO;
|
close CPUINFO;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$cores = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# don't run empty children
|
# don't run empty children
|
||||||
if (scalar @files <= $cores)
|
if (scalar @files <= $cores)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue