Fixed: Number of cores wrongly detected for Ryzen in rare cases.

This commit is contained in:
aristocratos 2022-10-07 13:41:04 +02:00
parent 7a2556eae5
commit e5cc895015

View file

@ -26,6 +26,7 @@ tab-size = 4
#include <netdb.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <thread>
#if !(defined(STATIC_BUILD) && defined(__GLIBC__))
#include <pwd.h>
@ -106,10 +107,13 @@ namespace Shared {
if (passwd_path.empty())
Logger::warning("Could not read /etc/passwd, will show UID instead of username.");
coreCount = sysconf(_SC_NPROCESSORS_CONF);
coreCount = std::thread::hardware_concurrency();
if (coreCount < 1) {
coreCount = 1;
Logger::warning("Could not determine number of cores, defaulting to 1.");
coreCount = sysconf(_SC_NPROCESSORS_CONF);
if (coreCount < 1) {
coreCount = 1;
Logger::warning("Could not determine number of cores, defaulting to 1.");
}
}
pageSize = sysconf(_SC_PAGE_SIZE);