I am implementing multithreading and I need the real number of physical cores to avoid creating more threads than CPU can handle. There is SystemInfo.processorCount but returns the number of threads (logical cores) instead of physical ones.
Hi, this is how I would do it in C#:
using System;
class Sample
{
public static void Main()
{
Console.WriteLine(
"The number of processors on this computer is {0}.",
Environment.ProcessorCount
);
}
}
To adapt this for unity this should work:
using System;
void Start()
{
Debug.log(Environment.ProcessorCount);
}
Please note that this is quite inefficient