Detect Windows operating system in ./configure
[fio.git] / os / os.h
diff --git a/os/os.h b/os/os.h
index a6bc17f09b5797632697de1b4c434f8f1a68482f..7f92d1bc710bbf84a13c582a7e0d5c7893b36697 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -327,6 +327,22 @@ static inline unsigned int cpus_online(void)
 }
 #endif
 
+#ifndef CONFIG_CPU_COUNT
+#ifdef FIO_HAVE_CPU_AFFINITY
+static inline int CPU_COUNT(os_cpu_mask_t *mask)
+{
+       int max_cpus = cpus_online();
+       int nr_cpus, i;
+
+       for (i = 0, nr_cpus = 0; i < max_cpus; i++)
+               if (fio_cpu_isset(mask, i))
+                       nr_cpus++;
+
+       return nr_cpus;
+}
+#endif
+#endif
+
 #ifndef FIO_HAVE_GETTID
 static inline int gettid(void)
 {