[x265] CLI: new logic for '--pools <int>' option

Mateusz mateuszb at poczta.onet.pl
Sun May 15 21:07:21 CEST 2016


-------------- next part --------------
# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1463338022 -7200
#      Sun May 15 20:47:02 2016 +0200
# Node ID 3fb14cfcf331701190b3b71122253c42c77caf94
# Parent  e5b5bdc3c154f908706fb75e006f9abf9b3de96f
CLI: new logic for '--pools <int>' option

For '--pools N' option we create exactly N threads.
For old logic please add a comma, for example '--pools 24,'

diff -r e5b5bdc3c154 -r 3fb14cfcf331 source/common/threadpool.cpp
--- a/source/common/threadpool.cpp	Sat May 14 07:29:46 2016 +0530
+++ b/source/common/threadpool.cpp	Sun May 15 20:47:02 2016 +0200
@@ -256,7 +256,7 @@
             cpusPerNode[X265_MIN(node, (UCHAR)MAX_NODE_NUM)]++;
         else
 #elif HAVE_LIBNUMA
-        if (bNumaSupport >= 0)
+        if (bNumaSupport)
             cpusPerNode[X265_MIN(numa_node_of_cpu(i), MAX_NODE_NUM)]++;
         else
 #endif
@@ -297,8 +297,16 @@
             else
             {
                 int count = atoi(nodeStr);
-                threadsPerPool[i] = X265_MIN(count, cpusPerNode[i]);
-                nodeMaskPerPool[i] = ((uint64_t)1 << i);
+                if (i > 0 || strchr(nodeStr, ','))   // it is comma -> old logic
+                {
+                    threadsPerPool[i] = X265_MIN(count, cpusPerNode[i]);
+                    nodeMaskPerPool[i] = ((uint64_t)1 << i);
+                }
+                else                                 // new logic: exactly 'count' threads on all NUMAs
+                {
+                    threadsPerPool[numNumaNodes] = X265_MIN(count, numNumaNodes * MAX_POOL_THREADS);
+                    nodeMaskPerPool[numNumaNodes] = ((uint64_t)-1 >> (64 - numNumaNodes));
+                }
             }
 
             /* consume current node string, comma, and white-space */


More information about the x265-devel mailing list