[libgxps] regtest: Use the number of cpus as default number of worker threads



commit f6234106f61ecfd9845db071b078845423fe9895
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Tue Jun 23 17:28:50 2015 +0200

    regtest: Use the number of cpus as default number of worker threads

 regtest/main.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/regtest/main.py b/regtest/main.py
index 1a29bce..a6a9c3d 100644
--- a/regtest/main.py
+++ b/regtest/main.py
@@ -39,6 +39,8 @@ class HelpAction(argparse.Action):
         sys.exit(0)
 
 def main(args):
+    n_cpus = cpu_count()
+
     parser = argparse.ArgumentParser(
         description = 'libgxps regression tests',
         prog = 'gxps-regtest',
@@ -59,8 +61,8 @@ def main(args):
                         action = 'store', dest = 'skipped_file',
                         help = 'File containing tests to skip')
     parser.add_argument('-t', '--threads',
-                        action = 'store', dest = 'threads', type = int, default = 1,
-                        help = 'Number of worker threads')
+                        action = 'store', dest = 'threads', type = int, default = n_cpus,
+                        help = 'Number of worker threads (Default: %d)' % n_cpus)
 
     ns, args = parser.parse_known_args(args)
     if not args:
@@ -69,7 +71,7 @@ def main(args):
 
     config = Config(vars(ns))
     if config.threads <= 0:
-        config.threads = cpu_count() - config.threads
+        config.threads = n_cpus - config.threads
 
     try:
         commands.run(args)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]