mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-20 19:30:23 +12:00
Fixed: Number of cores wrongly detected for Ryzen in rare cases.
This commit is contained in:
parent
7a2556eae5
commit
e5cc895015
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue