pa_log_debug(_("Running on host: %s"), s);
pa_xfree(s);
+ pa_log_debug(_("Found %u CPUs."), pa_ncpus());
+
pa_log_info(_("Page size is %lu bytes"), (unsigned long) PA_PAGE_SIZE);
#ifdef HAVE_VALGRIND_MEMCHECK_H
pa_assert(pa_gcd(*num, *den) == 1);
}
+
+unsigned pa_ncpus(void) {
+ long ncpus;
+
+#ifdef _SC_NPROCESSORS_CONF
+ ncpus = sysconf(_SC_NPROCESSORS_CONF);
+#else
+ ncpus = 1;
+#endif
+
+ return ncpus <= 0 ? 1 : (unsigned) ncpus;
+}
unsigned pa_gcd(unsigned a, unsigned b);
void pa_reduce(unsigned *num, unsigned *den);
+unsigned pa_ncpus(void);
+
#endif