Fixed a bug where measured rate was not reported properly
[integration/test.git] / test / tools / odl-mdsal-clustering-tests / clustering-performance-test / flow_config_blaster.py
index 19dfed7c610b3171237b4f8c57181c40370c7720..94e1be00f260a8de1eb038b197227e49054e1134 100755 (executable)
@@ -237,7 +237,7 @@ class FlowConfigBlaster(object):
     def run_cycle(self, function):
         """
         Runs an add or delete cycle. Starts a number of worker threads that each add a bunch of flows. Work is done
-        in context of the worker threads
+        in context of the worker threads.
         """
 
         for c in range(self.ncycles):
@@ -259,7 +259,7 @@ class FlowConfigBlaster(object):
             with self.print_lock:
                 print '    Total success rate: %.2f, Total rate: %.2f' % (
                     self.ok_rate.value, self.total_rate.value)
-                measured_rate = self.nthreads * self.nflows * self.ncycles / t.secs
+                measured_rate = (self.nthreads * self.nflows) / t.secs
                 print '    Measured rate:      %.2f (%.2f%% of Total success rate)' % \
                       (measured_rate, measured_rate / self.total_rate.value * 100)
                 self.threads_done = 0
@@ -282,13 +282,17 @@ class FlowConfigBlaster(object):
 
 
 def get_json_from_file(filename):
+    """
+    Get a flow programming template from a file
+    :param filename: File from which to get the template
+    :return: The json flow template (string)
+    """
     with open(filename, 'r') as f:
         read_data = f.read()
     return read_data
 
 
 if __name__ == "__main__":
-
     JSON_FLOW_MOD1 = '''{
         "flow-node-inventory:flow": [
             {