summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/os/get_system_cpus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnetdata/os/get_system_cpus.c')
-rw-r--r--src/libnetdata/os/get_system_cpus.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libnetdata/os/get_system_cpus.c b/src/libnetdata/os/get_system_cpus.c
index 5a76d8aa5..f8234d8bc 100644
--- a/src/libnetdata/os/get_system_cpus.c
+++ b/src/libnetdata/os/get_system_cpus.c
@@ -2,10 +2,6 @@
#include "../libnetdata.h"
-#if defined(OS_WINDOWS)
-#include <windows.h>
-#endif
-
#define CPUS_FOR_COLLECTORS 0
#define CPUS_FOR_NETDATA 1
@@ -82,7 +78,14 @@ long os_get_system_cpus_cached(bool cache, bool for_netdata) {
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
- return (long) sysInfo.dwNumberOfProcessors;
+ processors[index] = sysInfo.dwNumberOfProcessors;
+
+ if(processors[index] < 1) {
+ processors[index] = 1;
+ netdata_log_error("Assuming system has %ld processors.", processors[index]);
+ }
+
+ return processors[index];
#else