From 44ede2c6b81e60d81dcf46c3f0bc39ff7006f0a7 Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Thu, 6 Jul 2023 20:24:25 -0700 Subject: [PATCH] Address Feedback --- src/ARMeilleure/Translation/Translator.cs | 1 + src/Ryujinx.Common/SystemInfo/SystemInfo.cs | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ARMeilleure/Translation/Translator.cs b/src/ARMeilleure/Translation/Translator.cs index f6911920b..d3bf6c4f9 100644 --- a/src/ARMeilleure/Translation/Translator.cs +++ b/src/ARMeilleure/Translation/Translator.cs @@ -105,6 +105,7 @@ namespace ARMeilleure.Translation public void Execute(State.ExecutionContext context, ulong address) { int physicalCoreCount = SystemInfo.GetPhysicalCoreCount(); + if (Interlocked.Increment(ref _threadCount) == 1) { IsReadyForTranslation.WaitOne(); diff --git a/src/Ryujinx.Common/SystemInfo/SystemInfo.cs b/src/Ryujinx.Common/SystemInfo/SystemInfo.cs index 878422513..f17b921b4 100644 --- a/src/Ryujinx.Common/SystemInfo/SystemInfo.cs +++ b/src/Ryujinx.Common/SystemInfo/SystemInfo.cs @@ -94,17 +94,11 @@ namespace Ryujinx.Common.SystemInfo } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - string cpuCoresLine = File.ReadLines("/proc/cpuinfo") - .FirstOrDefault(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)) @@ -122,13 +116,15 @@ namespace Ryujinx.Common.SystemInfo }; process.Start(); + coreCount = int.Parse(process.StandardOutput.ReadToEnd()); + process.WaitForExit(); } } catch (Exception ex) { - Console.WriteLine("An error occurred while trying to get the physical core count: " + ex.Message); + Logger.Error?.Print(LogClass.Application,"An error occurred while trying to get the physical core count: {ex.Message}"); } return coreCount;