Commit 02e8f427 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Janne Grunau

win32: detect number of CPUs using affinity

Signed-off-by: 's avatarJanne Grunau <janne-libav@jannau.net>
parent b73ec054
...@@ -1084,9 +1084,9 @@ HAVE_LIST=" ...@@ -1084,9 +1084,9 @@ HAVE_LIST="
fork fork
getaddrinfo getaddrinfo
gethrtime gethrtime
GetProcessAffinityMask
GetProcessMemoryInfo GetProcessMemoryInfo
GetProcessTimes GetProcessTimes
GetSystemInfo
getrusage getrusage
gnu_as gnu_as
ibm_asm ibm_asm
...@@ -2864,8 +2864,8 @@ check_func sysctl ...@@ -2864,8 +2864,8 @@ check_func sysctl
check_func_headers io.h setmode check_func_headers io.h setmode
check_func_headers lzo/lzo1x.h lzo1x_999_compress check_func_headers lzo/lzo1x.h lzo1x_999_compress
check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
check_func_headers windows.h GetProcessAffinityMask
check_func_headers windows.h GetProcessTimes check_func_headers windows.h GetProcessTimes
check_func_headers windows.h GetSystemInfo
check_func_headers windows.h MapViewOfFile check_func_headers windows.h MapViewOfFile
check_func_headers windows.h VirtualAlloc check_func_headers windows.h VirtualAlloc
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <sched.h> #include <sched.h>
#endif #endif
#if HAVE_GETSYSTEMINFO #if HAVE_GETPROCESSAFFINITYMASK
#include <windows.h> #include <windows.h>
#endif #endif
#if HAVE_SYSCTL #if HAVE_SYSCTL
...@@ -169,10 +169,11 @@ static int get_logical_cpus(AVCodecContext *avctx) ...@@ -169,10 +169,11 @@ static int get_logical_cpus(AVCodecContext *avctx)
if (!ret) { if (!ret) {
nb_cpus = CPU_COUNT(&cpuset); nb_cpus = CPU_COUNT(&cpuset);
} }
#elif HAVE_GETSYSTEMINFO #elif HAVE_GETPROCESSAFFINITYMASK
SYSTEM_INFO sysinfo; DWORD_PTR proc_aff, sys_aff;
GetSystemInfo(&sysinfo); ret = GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff);
nb_cpus = sysinfo.dwNumberOfProcessors; if (ret)
nb_cpus = av_popcount64(proc_aff);
#elif HAVE_SYSCTL && defined(HW_NCPU) #elif HAVE_SYSCTL && defined(HW_NCPU)
int mib[2] = { CTL_HW, HW_NCPU }; int mib[2] = { CTL_HW, HW_NCPU };
size_t len = sizeof(nb_cpus); size_t len = sizeof(nb_cpus);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment