[erlang-questions] SMP enabled or not?

Barry Nicholson b.nicholson@REDACTED
Sat Jul 23 22:33:59 CEST 2011


I have no idea about questions 1 & 2.

Theoretically, you can use the following code to discover how
many cpus are on a machine.

application:start(sasl).
application:start(os_mon).
cpu_sup:util([per_cpu]).

However, it doesn't work on Macs or at least mine.

We also write a small library routine that parses /proc/cpuinfo on 
Linux.  /proc/cpuinfo has a line of the
form

processor: x

where x is the cpu id.   We simply retrieved the largest x found in the 
file.  Thus we then have the number of cpus on that machine.  Remember 
this doesn't work on Windows, Mac, embedded or many other OSs.

But the second method isn't an Erlang way.

Barry Nicholson

On 7/23/11 3:10 PM, Zabrane Mickael wrote:
> Hi,
>
> Is there an Erlang way which let me know if:
>
> 1. the Erlang VM was compiled with SMP support or not?
> 2. the Erlang VM was started with SMP enabled (i.e "erl -smp enable" )
> 3. how many cores are available on my machine?
>
> Regards
> Z.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list