int fio_monotonic_clocktest(int debug)
{
struct clock_thread *cthreads;
- unsigned int seen_cpus, nr_cpus = cpus_online();
+ unsigned int seen_cpus, nr_cpus = cpus_configured();
struct clock_entry *entries;
unsigned long nr_entries, tentries, failed = 0;
struct clock_entry *prev, *this;
pthread_condattr_t cattr;
struct idle_prof_thread *ipt;
- ipc.nr_cpus = cpus_online();
+ ipc.nr_cpus = cpus_configured();
ipc.status = IDLE_PROF_STATUS_OK;
if (ipc.opt == IDLE_PROF_OPT_NONE)
int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
{
unsigned int i, index, cpus_in_mask;
- const long max_cpu = cpus_online();
+ const long max_cpu = cpus_configured();
cpus_in_mask = fio_cpu_count(mask);
if (!cpus_in_mask)
return 1;
}
- max_cpu = cpus_online();
+ max_cpu = cpus_configured();
for (i = 0; i < sizeof(int) * 8; i++) {
if ((1 << i) & *val) {
strip_blank_front(&str);
strip_blank_end(str);
- max_cpu = cpus_online();
+ max_cpu = cpus_configured();
while ((cpu = strsep(&str, ",")) != NULL) {
char *str2, *cpu2;
sprintf(buf, "%llu", mb_memory);
fio_keywords[1].replace = strdup(buf);
- l = cpus_online();
+ l = cpus_configured();
sprintf(buf, "%lu", l);
fio_keywords[2].replace = strdup(buf);
}
return ret;
}
-#define FIO_HAVE_CPU_ONLINE_SYSCONF
+#define FIO_HAVE_CPU_CONF_SYSCONF
-static inline unsigned int cpus_online(void)
+static inline unsigned int cpus_configured(void)
{
return mpctl(MPC_GETNUMSPUS, 0, NULL);
}
return atoi(size);
}
-#ifdef __powerpc64__
-#define FIO_HAVE_CPU_ONLINE_SYSCONF
-static inline unsigned int cpus_online(void)
-{
- return sysconf(_SC_NPROCESSORS_CONF);
-}
-#endif
-
static inline unsigned long long get_fs_free_size(const char *path)
{
unsigned long long ret;
static inline bool fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
{
- const unsigned int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+ const unsigned int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
unsigned int num_cpus;
processorid_t *cpus;
bool ret;
#define fio_swap64(x) _byteswap_uint64(x)
#define _SC_PAGESIZE 0x1
-#define _SC_NPROCESSORS_ONLN 0x2
+#define _SC_NPROCESSORS_CONF 0x2
#define _SC_PHYS_PAGES 0x4
#define SA_RESTART 0
return 0;
}
-#define FIO_HAVE_CPU_ONLINE_SYSCONF
-unsigned int cpus_online(void);
-
int first_set_cpu(os_cpu_mask_t *cpumask);
int fio_setaffinity(int pid, os_cpu_mask_t cpumask);
int fio_cpuset_init(os_cpu_mask_t *mask);
}
#endif
-#ifndef FIO_HAVE_CPU_ONLINE_SYSCONF
-static inline unsigned int cpus_online(void)
+#ifndef FIO_HAVE_CPU_CONF_SYSCONF
+static inline unsigned int cpus_configured(void)
{
- return sysconf(_SC_NPROCESSORS_ONLN);
+ return sysconf(_SC_NPROCESSORS_CONF);
}
#endif
#ifdef FIO_HAVE_CPU_AFFINITY
static inline int CPU_COUNT(os_cpu_mask_t *mask)
{
- int max_cpus = cpus_online();
+ int max_cpus = cpus_configured();
int nr_cpus, i;
for (i = 0, nr_cpus = 0; i < max_cpus; i++)
#include <windows.h>
-/* Return all processors regardless of processor group */
-unsigned int cpus_online(void)
-{
- return GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
-}
-
static void print_mask(os_cpu_mask_t *cpumask)
{
for (int i = 0; i < FIO_CPU_MASK_ROWS; i++)
MEMORYSTATUSEX status;
switch (name) {
- case _SC_NPROCESSORS_ONLN:
- val = GetNumLogicalProcessors();
+ case _SC_NPROCESSORS_CONF:
+ /*
+ * Using GetMaximumProcessorCount introduces a problem in
+ * gettime.c because Windows does not have
+ * fio_get_thread_affinity. Log sample (see #1479):
+ *
+ * CPU mask contains processor beyond last active processor index (2)
+ * clock setaffinity failed: No error
+ */
+ val = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
if (val == -1)
- log_err("sysconf(_SC_NPROCESSORS_ONLN) failed\n");
+ log_err("sysconf(_SC_NPROCESSORS_CONF) failed\n");
break;
DisconnectNamedPipe(hpipe);
CloseHandle(hpipe);
return ret;
-}
\ No newline at end of file
+}
.os = FIO_OS,
.arch = FIO_ARCH,
.bpp = sizeof(void *),
- .cpus = __cpu_to_le32(cpus_online()),
+ .cpus = __cpu_to_le32(cpus_configured()),
};
dprint(FD_NET, "server: sending probe reply\n");
use_bloom = 0;
if (!num_threads)
- num_threads = cpus_online();
+ num_threads = cpus_configured();
if (argc == optind)
return usage(argv);