[Python-checkins] r75460 - sandbox/trunk/ccbench/ccbench.py

antoine.pitrou python-checkins at python.org
Sat Oct 17 16:38:18 CEST 2009


Author: antoine.pitrou
Date: Sat Oct 17 16:38:18 2009
New Revision: 75460

Log:
Add an option to modify the max number of threads



Modified:
   sandbox/trunk/ccbench/ccbench.py

Modified: sandbox/trunk/ccbench/ccbench.py
==============================================================================
--- sandbox/trunk/ccbench/ccbench.py	(original)
+++ sandbox/trunk/ccbench/ccbench.py	Sat Oct 17 16:38:18 2009
@@ -208,7 +208,7 @@
     
     return results
 
-def run_throughput_tests(max_threads=4):
+def run_throughput_tests(max_threads):
     for task in throughput_tasks:
         print(task.__doc__)
         print()
@@ -323,7 +323,7 @@
     
     return results
 
-def run_latency_tests(max_threads=4):
+def run_latency_tests(max_threads):
     for task in latency_tasks:
         print("Background CPU task:", task.__doc__)
         print()
@@ -355,6 +355,9 @@
     parser.add_option("-i", "--interval",
                       action="store", type="int", dest="interval", default=None,
                       help="sys.setcheckinterval() value")
+    parser.add_option("-n", "--num-threads",
+                      action="store", type="int", dest="nthreads", default=4,
+                      help="max number of threads in tests")
     
     # Hidden option to run the pinging client
     parser.add_option("", "--latclient",
@@ -378,12 +381,12 @@
     if options.throughput:
         print("--- Throughput ---")
         print()
-        run_throughput_tests()
+        run_throughput_tests(options.nthreads)
     
     if options.latency:
         print("--- Latency ---")
         print()
-        run_latency_tests()
+        run_latency_tests(options.nthreads)
 
 if __name__ == "__main__":
     main()


More information about the Python-checkins mailing list