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 21d5593446
commit 00fee4715e

View file

@ -94,8 +94,18 @@ namespace Ryujinx.Common.SystemInfo
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
coreCount = File.ReadLines("/proc/cpuinfo")
.Count(line => line.Contains("cpu cores"));
string cpuCoresLine = File.ReadLines("/proc/cpuinfo")
.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))
{