[erlang-questions] logical_processors_available unknown on mac
Fri Feb 19 00:42:04 CET 2016
Yeah, I know there are some sysctl OSX flags that can be looked up, the
thing that I don't know if those are the same as those used on the Linux
(or other?) implementations.
On Thu, Feb 18, 2016 at 10:54 PM, Richard A. O'Keefe <>
> On 19/02/16 12:46 am, Alin Popa wrote:
>> On Wed, Feb 17, 2016 at 1:25 PM, Alin Popa < <mailto:
>> >> wrote:
>> I was recently trying to use
>> `erlang:system_info(logical_processors_available).` on my mac,
>> and getting `unknown` atom back; anyone has any idea if this
>> is really by design?
> | head
> % sysctl -a | grep cpu | head
> hw.ncpu = 4
> hw.cpufrequency = 3200000000
> to= 4
> hw.ncpu: 4
> hw.activecpu: 4
> hw.physicalcpu: 4
> hw.physicalcpu_max: 4
> hw.logicalcpu: 4
> hw.logicalcpu_max: 4
> hw.cputype: 7
> You can get at this with, e.g.,
> int ans; size_t anslen = sizeof ans;
> sysctlbyname("hw.activecpu", &ans, &anslen, 0, 0)
> For that matter,
> are supported.
> * hw.activecpu - The number of processors currently
> available for executing threads.
> * Use this number to determine the number
> threads to create in SMP aware applications.
> * This number can change when power
> management modes are changed.
> There are so many ways to count the number of CPUs on a Mac.
> I suspect that hw.activecpu is the one to use; if it isn't, then
> hw.logicalcpu may be the one.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions