Commit ad29ecbf authored by Janne Grunau's avatar Janne Grunau

windows: use number of CPUs as automatic thread count

parent ea4d5f48
...@@ -1086,6 +1086,7 @@ HAVE_LIST=" ...@@ -1086,6 +1086,7 @@ HAVE_LIST="
gethrtime gethrtime
GetProcessMemoryInfo GetProcessMemoryInfo
GetProcessTimes GetProcessTimes
GetSystemInfo
getrusage getrusage
gnu_as gnu_as
ibm_asm ibm_asm
...@@ -2859,6 +2860,7 @@ check_func_headers io.h setmode ...@@ -2859,6 +2860,7 @@ 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 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
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#if HAVE_SCHED_GETAFFINITY #if HAVE_SCHED_GETAFFINITY
#define _GNU_SOURCE #define _GNU_SOURCE
#include <sched.h> #include <sched.h>
#elif HAVE_GETSYSTEMINFO
#include <windows.h>
#endif #endif
#include "avcodec.h" #include "avcodec.h"
...@@ -156,6 +158,10 @@ static int get_logical_cpus(AVCodecContext *avctx) ...@@ -156,6 +158,10 @@ static int get_logical_cpus(AVCodecContext *avctx)
if (!ret) { if (!ret) {
nb_cpus = CPU_COUNT(&cpuset); nb_cpus = CPU_COUNT(&cpuset);
} }
#elif HAVE_GETSYSTEMINFO
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
nb_cpus = sysinfo.dwNumberOfProcessors;
#endif #endif
av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus); av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
return FFMIN(nb_cpus, MAX_AUTO_THREADS); return FFMIN(nb_cpus, MAX_AUTO_THREADS);
......
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