h = OpenThread(THREAD_QUERY_INFORMATION | THREAD_SET_INFORMATION, TRUE, pid);
if (h != NULL) {
bSuccess = SetThreadAffinityMask(h, cpumask);
+ if (!bSuccess)
+ log_err("fio_setaffinity failed: failed to set thread affinity (pid %d, mask %.16llx)\n", pid, cpumask);
+
CloseHandle(h);
+ } else {
+ log_err("fio_setaffinity failed: failed to get handle for pid %d\n", pid);
}
return (bSuccess)? 0 : -1;
static inline void fio_cpu_set(os_cpu_mask_t *mask, int cpu)
{
- *mask |= 1 << (cpu-1);
+ *mask |= 1 << cpu;
}
static inline int fio_cpuset_init(os_cpu_mask_t *mask)