[x265] [PATCH] ThreadPool.cpp: fix getCpuCount function for windows systems

Praveen Tiwari praveen at multicorewareinc.com
Fri May 20 12:58:42 CEST 2016


Please ignore this sending updated patch. thanks.

Regards,
Praveen

On Tue, May 17, 2016 at 7:17 PM, <praveen at multicorewareinc.com> wrote:

> # HG changeset patch
> # User Praveen Tiwari <praveen at multicorewareinc.com>
> # Date 1463492830 -19800
> #      Tue May 17 19:17:10 2016 +0530
> # Node ID cf3c2e0dce0997a499ae1d50fda6891cae83e685
> # Parent  372fc5b12ed6003f8784702956ccf7203ea68a2e
> ThreadPool.cpp: fix getCpuCount function for windows systems
>
> diff -r 372fc5b12ed6 -r cf3c2e0dce09 source/common/threadpool.cpp
> --- a/source/common/threadpool.cpp      Tue May 17 19:06:36 2016 +0530
> +++ b/source/common/threadpool.cpp      Tue May 17 19:17:10 2016 +0530
> @@ -545,9 +545,17 @@
>  int ThreadPool::getCpuCount()
>  {
>  #if _WIN32
> -    SYSTEM_INFO sysinfo;
> -    GetSystemInfo(&sysinfo);
> -    return sysinfo.dwNumberOfProcessors;
> +    enum { MAX_NODE_NUM = 127 };
> +    int cpus = 0;
> +    int numNumaNodes = X265_MIN(getNumaNodeCount(), MAX_NODE_NUM);
> +    PGROUP_AFFINITY groupAffinityPointer = new GROUP_AFFINITY;
> +    for (int i = 0; i < numNumaNodes; i++)
> +    {
> +        GetNumaNodeProcessorMaskEx((UCHAR)i, groupAffinityPointer);
> +        cpus += (int)bitCount(groupAffinityPointer->Mask);
> +    }
> +    delete groupAffinityPointer;
> +    return cpus;
>  #elif __unix__ && X265_ARCH_ARM
>      /* Return the number of processors configured by OS. Because, most
> embedded linux distributions
>       * uses only one processor as the scheduler doesn't have enough work
> to utilize all processors */
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160520/386277c2/attachment-0001.html>


More information about the x265-devel mailing list