mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
|
||||
use Switch;
|
||||
use List::Util 'shuffle'; # standard from Perl 5.8 and later
|
||||
|
||||
my $tempfile = "multigcc.out";
|
||||
|
@ -24,11 +25,26 @@ my $command = join " ", @params;
|
|||
@files = shuffle(@files);
|
||||
|
||||
# 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") {
|
||||
$cores = scalar grep /^processor/i, <CPUINFO>;
|
||||
close CPUINFO;
|
||||
}
|
||||
else {
|
||||
$cores = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# don't run empty children
|
||||
if (scalar @files <= $cores)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue