RESOLVED FIXED 38833
[chromium] detect num processors to pass to make -j on Linux
https://bugs.webkit.org/show_bug.cgi?id=38833
Summary [chromium] detect num processors to pass to make -j on Linux
Tony Chang
Reported 2010-05-10 00:16:05 PDT
[chromium] detect num processors to pass to make -j on Linux
Attachments
Patch (1.20 KB, patch)
2010-05-10 00:17 PDT, Tony Chang
no flags
Patch (1.20 KB, patch)
2010-05-10 16:34 PDT, Tony Chang
no flags
Tony Chang
Comment 1 2010-05-10 00:17:20 PDT
Tony Chang
Comment 2 2010-05-10 00:18:00 PDT
Since evan knows perl, maybe he can review? The previous code was hard coded to use -j4.
Evan Martin
Comment 3 2010-05-10 11:27:15 PDT
This looks fine to me. I ran it by a perl-hacker friend and he suggested the following. Note that if the grep fails for some reason in your original code your numCpus ends up being 0, which might be bad. my $numCpus = (grep /processor/, `cat /proc/cpuinfox`) || 1; In list context, `` splits on lines so the grep works linewise, and then when you stuff the list that grep returns into scalar context (numCpus) it gets the length of the list. Perl is so awesome in a scary sort of way! Your original code LGTM as well.
Tony Chang
Comment 4 2010-05-10 16:34:48 PDT
Tony Chang
Comment 5 2010-05-10 16:35:48 PDT
Comment on attachment 55620 [details] Patch Updated to use perl's grep and to have a fallback in case of failure.
Tony Chang
Comment 6 2010-05-11 20:51:25 PDT
Comment on attachment 55620 [details] Patch Clearing flags on attachment: 55620 Committed r59201: <http://trac.webkit.org/changeset/59201>
Tony Chang
Comment 7 2010-05-11 20:51:30 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.