X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fwindows%2Fcpu-affinity.c;h=7601970fc7c284bd120d0ed1b6637ed46882dae3;hp=46fd048d3abc26180cff0d5bc66edeb436fd157e;hb=HEAD;hpb=4937100f4695df4893606f8aa9375cde62c2c80d diff --git a/os/windows/cpu-affinity.c b/os/windows/cpu-affinity.c index 46fd048d..8f3d6a76 100644 --- a/os/windows/cpu-affinity.c +++ b/os/windows/cpu-affinity.c @@ -2,84 +2,6 @@ #include -#ifdef CONFIG_WINDOWS_XP -int fio_setaffinity(int pid, os_cpu_mask_t cpumask) -{ - HANDLE h; - BOOL bSuccess = FALSE; - - 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, (long long unsigned) cpumask); - - CloseHandle(h); - } else { - log_err("fio_setaffinity failed: failed to get handle for pid %d\n", - pid); - } - - return bSuccess ? 0 : -1; -} - -int fio_getaffinity(int pid, os_cpu_mask_t *mask) -{ - os_cpu_mask_t systemMask; - - HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, TRUE, pid); - - if (h != NULL) { - GetProcessAffinityMask(h, mask, &systemMask); - CloseHandle(h); - } else { - log_err("fio_getaffinity failed: failed to get handle for pid %d\n", - pid); - return -1; - } - - return 0; -} - -void fio_cpu_clear(os_cpu_mask_t *mask, int cpu) -{ - *mask &= ~(1ULL << cpu); -} - -void fio_cpu_set(os_cpu_mask_t *mask, int cpu) -{ - *mask |= 1ULL << cpu; -} - -int fio_cpu_isset(os_cpu_mask_t *mask, int cpu) -{ - return (*mask & (1ULL << cpu)) != 0; -} - -int fio_cpu_count(os_cpu_mask_t *mask) -{ - return hweight64(*mask); -} - -int fio_cpuset_init(os_cpu_mask_t *mask) -{ - *mask = 0; - return 0; -} - -int fio_cpuset_exit(os_cpu_mask_t *mask) -{ - return 0; -} -#else /* CONFIG_WINDOWS_XP */ -/* 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++) @@ -443,4 +365,3 @@ int fio_cpuset_exit(os_cpu_mask_t *mask) { return 0; } -#endif /* CONFIG_WINDOWS_XP */