Address Feedback

This commit is contained in:
sunshineinabox 2023-07-06 20:24:25 -07:00
parent d684e380a1
commit d782d57ca4
2 changed files with 5 additions and 8 deletions

View file

@ -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();

View file

@ -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;