Browse Source

[2225_statistics] change the variable names

`number` to `concurrency` and `cycle` to `number`
Naoki Kambe 12 years ago
parent
commit
0c8094b0e3
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/lib/python/isc/statistics/tests/counter_test.py

+ 7 - 7
src/lib/python/isc/statistics/tests/counter_test.py

@@ -33,15 +33,15 @@ def setup_functor(event, cycle, functor, *args):
     event.wait()
     event.wait()
     for i in range(cycle): functor(*args)
     for i in range(cycle): functor(*args)
 
 
-def start_functor(number, cycle, functor, *args):
+def start_functor(concurrency, number, functor, *args):
     """Creates the threads of the number and makes them start. Sets
     """Creates the threads of the number and makes them start. Sets
     the event and waits until these threads are finished."""
     the event and waits until these threads are finished."""
     threads = []
     threads = []
     event = threading.Event()
     event = threading.Event()
-    for i in range(number):
+    for i in range(concurrency):
         threads.append(threading.Thread(\
         threads.append(threading.Thread(\
                 target=setup_functor, \
                 target=setup_functor, \
-                    args=(event, cycle, functor,) + args))
+                    args=(event, number, functor,) + args))
     for th in threads: th.start()
     for th in threads: th.start()
     event.set()
     event.set()
     for th in threads: th.join()
     for th in threads: th.join()
@@ -123,12 +123,12 @@ class TestBasicMethods(unittest.TestCase):
 
 
     def test_rasing_incrementers(self):
     def test_rasing_incrementers(self):
         """ use Thread"""
         """ use Thread"""
-        number = 3    # number of the threads
+        concurrency = 3    # number of the threads
-        cycle = 10000 # number of counting per thread
+        number = 10000     # number of counting per thread
         counter_name = "counter"
         counter_name = "counter"
         timer_name = "seconds"
         timer_name = "seconds"
         start_time = counter._start_timer()
         start_time = counter._start_timer()
-        start_functor(number, cycle, self.counter.inc,
+        start_functor(concurrency, number, self.counter.inc,
                       counter_name)
                       counter_name)
         counter._stop_timer(start_time,
         counter._stop_timer(start_time,
                             self.counter._statistics._data,
                             self.counter._statistics._data,
@@ -137,7 +137,7 @@ class TestBasicMethods(unittest.TestCase):
         self.assertEqual(
         self.assertEqual(
             counter._get_counter(self.counter._statistics._data,
             counter._get_counter(self.counter._statistics._data,
                                  counter_name),
                                  counter_name),
-            number * cycle)
+            concurrency * number)
         self.assertGreater(
         self.assertGreater(
             counter._get_counter(self.counter._statistics._data,
             counter._get_counter(self.counter._statistics._data,
                                  timer_name), 0)
                                  timer_name), 0)