Code

check_load can optionally divide by number of cpus
[nagiosplug.git] / plugins / common.h
index dd9a05633bab99e6189585bfba9bde260a19cf37..752e21fffe4ab2a67a5a5eea0750d4883bb74a1c 100644 (file)
 #include <unistd.h>
 #endif
 
+/* GET_NUMBER_OF_CPUS is a macro to return 
+   number of CPUs, if we can get that data.
+   Use configure.in to test for various OS ways of
+   getting that data
+   Will return -1 if cannot get data
+*/
+#ifdef HAVE_SYSCONF__SC_NPROCESSORS_CONF 
+#define GET_NUMBER_OF_CPUS() sysconf(_SC_NPROCESSORS_CONF)
+#else
+#define GET_NUMBER_OF_CPUS() -1
+#endif
+
 #ifdef TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>