From 00fee4715e4b932a30b00d21401e7fc673c2046e Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Thu, 6 Jul 2023 00:53:40 -0700 Subject: [PATCH] Thanks to Benedani on Discord this should be correct way to get physical cores on linux now --- src/Ryujinx.Common/SystemInfo/SystemInfo.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.Common/SystemInfo/SystemInfo.cs b/src/Ryujinx.Common/SystemInfo/SystemInfo.cs index c4e941aa4..878422513 100644 --- a/src/Ryujinx.Common/SystemInfo/SystemInfo.cs +++ b/src/Ryujinx.Common/SystemInfo/SystemInfo.cs @@ -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)) {