1 |
2016-12-14 19:32 GMT+01:00 Nathan Zachary <nathanzachary@g.o>: |
2 |
|
3 |
> On 14/12/16 12:29, Fabian Groffen wrote: |
4 |
> > On 14-12-2016 13:01:16 -0500, Doug Freed wrote: |
5 |
> >> On Wed, Dec 14, 2016 at 12:48 PM, Nathan Zachary |
6 |
> >> <nathanzachary@g.o> wrote: |
7 |
> >>> On 14/12/16 10:11, Doug Freed wrote: |
8 |
> >>>>> I somehow doubt that would give me the expected number only, and I |
9 |
> lack |
10 |
> >>>>> a BSD install handy to test it. |
11 |
> >>>> $(sysctl -n hw.ncpu) |
12 |
> >>>> |
13 |
> >>> I don't know that the sysctl command works universally: |
14 |
> >>> |
15 |
> >>> # sysctl -n hw.ncpu |
16 |
> >>> sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory |
17 |
> >>> |
18 |
> >> It's BSD-specific (Darwin may have it too, but I'm not in OS X at the |
19 |
> >> moment, so I can't check), which pretty much describes this branch in |
20 |
> >> the codepath as well. Linux users will have the nproc command from |
21 |
> >> coreutils. |
22 |
> > Yes, Darwin has it too, but the tool lives in /usr/sbin instead: |
23 |
> > |
24 |
> > https://gitweb.gentoo.org/repo/proj/prefix.git/tree/ |
25 |
> scripts/bootstrap-prefix.sh#n1987 |
26 |
> > |
27 |
> > Fabian |
28 |
> > |
29 |
> > |
30 |
> Ah, yes, I missed the part about it being BSD-specific. |
31 |
> |
32 |
> This one-liner certainly isn't as graceful or elegant, but it works: |
33 |
> |
34 |
> # cat /proc/cpuinfo | grep 'processor' | wc -l |
35 |
> |
36 |
|
37 |
# grep -c processor /proc/cpuinfo |
38 |
|
39 |
however Documentation/filesystems/proc.txt is very vague on it's content, |
40 |
just stating it has info on the cpu, better leave this as a backup value |
41 |
IMHO |