[Webkit-unassigned] [Bug 38833] [chromium] detect num processors to pass to make -j on Linux

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 10 11:27:15 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38833





--- Comment #3 from Evan Martin <evan at chromium.org>  2010-05-10 11:27:15 PST ---
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.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list