This works on my MacBook Pro
getconf _NPROCESSORS_ONLN
8

The macOS centric way is this:
sysctl -n hw.logicalcpu
8

Thanks,

Andrew FIsh

On Mar 23, 2020, at 5:38 AM, Laszlo Ersek <lersek@redhat.com> wrote:

On 03/22/20 00:03, Rebecca Cran wrote:
Thank you. I think we probably do want to detect the number of threads
available: I'll see if I can work on that.

In a Linux environment, you can run "getconf _NPROCESSORS_ONLN".

In fact that's how I build the native BaseTools on my laptop:

$ . edksetup.sh
$ nice make -C "$EDK_TOOLS_PATH" -j $(getconf _NPROCESSORS_ONLN)

And from a cursory web search:

 https://stackoverflow.com/a/23569003

it is supposed to work on macOS too, and with a small tweak, on the BSDs
as well.

Thanks
Laszlo