mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-13 06:09:11 +00:00
Thanks to Benedani on Discord this should be correct way to get physical cores on linux now
This commit is contained in:
parent
0f255d9ada
commit
d684e380a1
1 changed files with 12 additions and 2 deletions
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue