diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index 2d04fa5..d31cf89 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -26,6 +26,7 @@ tab-size = 4 #include #include #include +#include #if !(defined(STATIC_BUILD) && defined(__GLIBC__)) #include @@ -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);