Thanks to Benedani on Discord this should be correct way to get physical cores on linux now

This commit is contained in:
sunshineinabox 2023-07-06 00:53:40 -07:00
parent 0f255d9ada
commit d684e380a1

View file

@ -94,8 +94,18 @@ namespace Ryujinx.Common.SystemInfo
} }
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{ {
coreCount = File.ReadLines("/proc/cpuinfo") string cpuCoresLine = File.ReadLines("/proc/cpuinfo")
.Count(line => line.Contains("cpu cores")); .FirstOrDefault(line => line.Contains("cpu cores"));
if (cpuCoresLine != null)
{
string[] parts = cpuCoresLine.Split(':');
if (parts.Length == 2 && int.TryParse(parts[1].Trim(), out int cores))
{
coreCount = cores;
Console.WriteLine("Number of physical cores: " + coreCount);
}
}
} }
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{ {