[Piglit] [PATCH 5/7] piglit: Run concurrent tests from as many threads as there are processors.
Eric Anholt
eric at anholt.net
Mon Aug 15 12:49:24 PDT 2011
Reduces runtime of piglit-run.py -t glslparser from 8.0 seconds to 5.4
seconds on my system.
---
framework/threads.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/framework/threads.py b/framework/threads.py
index 855fadf..724e84e 100644
--- a/framework/threads.py
+++ b/framework/threads.py
@@ -25,6 +25,7 @@ from threadpool import ThreadPool, WorkRequest
from patterns import Singleton
from threading import RLock
from weakref import WeakKeyDictionary
+import multiprocessing
def synchronized_self(function):
'''
@@ -44,7 +45,7 @@ synchronized_self.locks = WeakKeyDictionary() # track the locks for each instanc
class ConcurrentTestPool(Singleton):
@synchronized_self
def init(self):
- self.pool = ThreadPool(2)
+ self.pool = ThreadPool(multiprocessing.cpu_count())
@synchronized_self
def put(self, callable_, args = None, kwds = None):
--
1.7.5.4
More information about the Piglit
mailing list