summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-06-30 16:39:28 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-06-30 16:39:28 +0000
commit40f33f0e308278548534260e3adf932a418238fa (patch)
treec33159f1d516c3e5e373c1a13c1b8dbab661146c
parent94aa0d741e8aadff243b6b88092df7b30c1bc6e4 (diff)
downloadrockbox-40f33f0e308278548534260e3adf932a418238fa.tar.gz
rockbox-40f33f0e308278548534260e3adf932a418238fa.zip
Fix a problem where multigcc.pl sometimes produces lines like "sh-elf-gcc: no input files", especially on systems with many cores and for builds with (relatively) few files. This happened because the slice size was rounded up, which meant that in some cases there werere leftover slices.
Also remove the now unnecessary cores>files checking. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27196 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/multigcc.pl16
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl
index 5222f61b49..9be9978bd4 100755
--- a/tools/multigcc.pl
+++ b/tools/multigcc.pl
@@ -46,27 +46,25 @@ switch($^O) {
46 } 46 }
47} 47}
48 48
49# don't run empty children
50if (scalar @files <= $cores)
51{
52 $cores = 1;
53}
54
55# fork children 49# fork children
56my @pids; 50my @pids;
57my $slice = int((scalar @files + $cores) / $cores); 51my $slice = int((scalar @files + $cores) / $cores);
58for my $i (0 .. $cores-1) 52
53# reset $cores to 0 so we can count the number of actually used cores
54$cores=0;
55
56for (my $i=0;$i<scalar @files;$i += $slice)
59{ 57{
60 my $pid = fork; 58 my $pid = fork;
61 if ($pid) 59 if ($pid)
62 { 60 {
63 # mother 61 # mother
64 $pids[$i] = $pid; 62 $pids[$cores++] = $pid;
65 } 63 }
66 else 64 else
67 { 65 {
68 # get my slice of the files 66 # get my slice of the files
69 my @list = @files[$i * $slice .. $i * $slice + $slice - 1]; 67 my @list = @files[$i .. $i + $slice - 1];
70 68
71 # run command 69 # run command
72 system("$command @list > $tempfile.$$"); 70 system("$command @list > $tempfile.$$");