aboutsummaryrefslogtreecommitdiff
path: root/plugins/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/common.h')
-rw-r--r--plugins/common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/common.h b/plugins/common.h
index dd9a0563..752e21ff 100644
--- a/plugins/common.h
+++ b/plugins/common.h
@@ -80,6 +80,18 @@
#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>